Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type mismatch when assigning ref to TextField.TextArea #407

Open
zhyuhan opened this issue May 4, 2024 · 1 comment
Open

Type mismatch when assigning ref to TextField.TextArea #407

zhyuhan opened this issue May 4, 2024 · 1 comment

Comments

@zhyuhan
Copy link

zhyuhan commented May 4, 2024

Describe the bug
When trying to assign a ref of type HTMLTextAreaElement to a TextField.TextArea element, there is a type error of

Type 'HTMLTextAreaElement' is not assignable to type 'HTMLFormElement | ((el: HTMLFormElement) => void) | undefined'.
  Type 'HTMLTextAreaElement' is missing the following properties from type 'HTMLFormElement': acceptCharset, action, elements, encoding, and 11 more.ts(2322)

A similar type mismatch happens when using a callback for the ref prop.

To Reproduce
Steps to reproduce the behavior:

  1. Declare a new ref variable with type HTMLTextAreaElement
  2. Create a new TextField.TextArea element
  3. Assign the variable to the ref prop of the TextArea
  4. See TypeScript error

Expected behavior
There should be no type errors at all.

Additional context
Seems like the ref prop had the type HTMLTextAreaElement previously, but was changed to HTMLFormElement in #381. Was this intended?

@jer3m01
Copy link
Member

jer3m01 commented May 13, 2024

Thanks for the report, HTMLTextAreaElement should extend HTMLFormElement and not cause any type errors but I might've been mistaken, I'll have a look and fix the type.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants