Ensure the multiple prop is typed correctly when passing explicit types to the Combobox component (#3099)

* ensure `TMultiple` is correct when passing explicit types to the `Combobox`

When you use the `Combobox` component with explicit types:

```ts
<Combobox<MyType> />
```

Then we make sure that we properly set the `TMultiple` prop as well. It
defaults to `false` which seems to be the better default.

* update changelog
This commit is contained in:
Robin Malfait
2024-04-15 17:42:59 +02:00
committed by GitHub
parent cb9cda7bd0
commit 512bf44150
2 changed files with 7 additions and 5 deletions
+1
View File
@@ -19,6 +19,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Keep focus inside of the `<ComboboxInput />` component ([#3073](https://github.com/tailwindlabs/headlessui/pull/3073))
- Fix enter transitions for the `Transition` component ([#3074](https://github.com/tailwindlabs/headlessui/pull/3074))
- Render hidden form input fields for `Checkbox`, `Switch` and `RadioGroup` components ([#3095](https://github.com/tailwindlabs/headlessui/pull/3095))
- Ensure the `multiple` prop is typed correctly when passing explicit types to the `Combobox` component ([#3099](https://github.com/tailwindlabs/headlessui/pull/3099))
### Changed
@@ -1830,11 +1830,12 @@ function OptionFn<
// ---
export interface _internal_ComponentCombobox extends HasDisplayName {
<TValue, TTag extends ElementType = typeof DEFAULT_COMBOBOX_TAG>(
props: ComboboxProps<TValue, true, TTag> & RefProp<typeof ComboboxFn>
): JSX.Element
<TValue, TTag extends ElementType = typeof DEFAULT_COMBOBOX_TAG>(
props: ComboboxProps<TValue, false, TTag> & RefProp<typeof ComboboxFn>
<
TValue,
TMultiple extends boolean | undefined = false,
TTag extends ElementType = typeof DEFAULT_COMBOBOX_TAG,
>(
props: ComboboxProps<TValue, TMultiple, TTag> & RefProp<typeof ComboboxFn>
): JSX.Element
}