Closed ShaharIlany closed 1 year ago
Hey @FezVrasta, Thanks for the quick response!
When using Typescript, The following error occurs when not providing those types:
Type 'Dispatch<SetStateAction<null>>' is not assignable to type 'LegacyRef<HTMLInputElement> | undefined'.
Type 'Dispatch<SetStateAction<null>>' is not assignable to type '(instance: HTMLInputElement | null) => void'.
Types of parameters 'value' and 'instance' are incompatible.
Type 'HTMLInputElement | null' is not assignable to type 'SetStateAction<null>'.
Type 'HTMLInputElement' is not assignable to type 'SetStateAction<null>'.
Type 'HTMLInputElement' provides no match for the signature '(prevState: null): null'.ts(2322)
I've just started using the library and run into this issue.
And like me, many others as you might already know 😄 https://github.com/floating-ui/react-popper/issues/415 I think it's might be a good idea to add those typings or some note in this page that this could happen and how to resolve it.
The example is just JavaScript, there's nothing wrong with it. If someone wants to use TypeScript they should know to use React with it, it has nothing to do with Popper itself.
I don't agree, and judging by the 82 thumbs up on the comment here https://github.com/floating-ui/react-popper/issues/415#issuecomment-821968179 I think many people would benefit from it.
The world is beautiful because of its diversity.
Add typing to useState