-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Make React types more compatible with other libraries #2282
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
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
oh hello wall of red text. Apparently have type errors to track down. 😓 |
packages/@headlessui-react/src/components/combobox/combobox.tsx
Outdated
Show resolved
Hide resolved
// TODO: One day we will be able to infer this type from the generic in Combobox itself. | ||
// But today is not that day.. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Random off-topic side note: I think one way we can solve this is by introduce a different API using some factory like functions. Example:
let Combobox = createCombobox<TypeYouWant>()
Which could create the Combobox
, Combobox.Input
, Combobox.Option
, ... components already scoped to the TypeYouWant
🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hah that's pretty good idea 🤔
Would be a good thing to explore for future improvements
packages/@headlessui-react/src/components/combobox/combobox.tsx
Outdated
Show resolved
Hide resolved
3ccf067
to
9845866
Compare
17245c0
to
d747cee
Compare
I'm coming from #1394, looking through this commit to try and work out how to use props from a headless UI component. I was stuck trying to work out what "types" to pass in to the For others in the same boat, it looks like we can use the types that are valid for the headless UI component |
As a part of this we have done a few things:
PropsComponentNameHere
type which is appropriately generic and represents what you can pass to a component's props. Note that this will include props inherited from the component's tag.displayName
and enabling inference to continue working (this was way more difficult than it should've been 🙃 )Fixes #1365
Fixes #1394