kobalte
kobalte copied to clipboard
Type mismatch when assigning `ref` to `TextField.TextArea`
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:
- Declare a new
refvariable with typeHTMLTextAreaElement - Create a new
TextField.TextAreaelement - Assign the variable to the
refprop of theTextArea - 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?
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.