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

Improve the types of the Combobox component #1761

Merged
merged 2 commits into from
Aug 11, 2022
Merged

Conversation

RobinMalfait
Copy link
Member

@RobinMalfait RobinMalfait commented Aug 11, 2022

The Combobox types weren't super well defined and the were especially confusing in combination with the nullable and multiple props.

Now given the multiple and/or nullable props we ensure that the types for the value, defaultValue, onChange, by, render prop, ... are all correct.

You will also be able to easily tell which type to use instead of inferring it by doing something like this:

<Combobox<ExplicitTypeHere>
  value={...}
  onChange={...}
  ...
>
 ...
</Combobox>

Fixes: #1702

@vercel
Copy link

vercel bot commented Aug 11, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
headlessui-react ✅ Ready (Inspect) Visit Preview Aug 11, 2022 at 9:01PM (UTC)
headlessui-vue ✅ Ready (Inspect) Visit Preview Aug 11, 2022 at 9:01PM (UTC)

Now given the `multiple` and/or `nullable` props we ensure that the
types for the `value`, `defaultValue`, `onChange`, `by`, render prop,
... are all correct.

You will also be able to easily tell which type to use instead of
inferring it by doing something like this:

```tsx
<Combobox<ExplicitTypeHere>
  value={...}
  onChange={...}
  ...
>
 ...
</Combobox>
```
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

Successfully merging this pull request may close these issues.

[Combobox] onChange type incorrectly determined
1 participant