Open jegork opened 1 month ago
I second this, i'm supplying a type to my select/ autocomplete as below and im still getting type errors
<Autocomplete<{label: string, value: string}>
variant={variant}
radius={radius}
labelPlacement={labelPlacement}
defaultItems={defaultItems}
items={items}
{...props}
>
{(d) => (
<AutocompleteItem<Option> key={d.value}>{d.label}</AutocompleteItem>
)}
</Autocomplete>
to fix it i need to do the following
<Autocomplete<{label: string, value: string}>
variant={variant}
radius={radius}
labelPlacement={labelPlacement as {label:string, value: string}}
defaultItems={defaultItems as {label:string, value: string}}
items={items}
{...props}
>
{(d) => (
<AutocompleteItem<Option> key={d.value}>{d.label}</AutocompleteItem>
)}
</Autocomplete>
NextUI Version
0.0.0-canary-20240520130845
Describe the bug
When having a Custom Select component:
And using the component with
items
field, theitems
are not typed correctly.Because
item
param inchildren
is typed asobject
, it is not possible to access fields ofitem
.However, everything works with normal Select (not custom one)
Your Example Website or App
No response
Steps to Reproduce the Bug or Issue
Code above should be enough to reproduce
Expected behavior
I guess the types for Custom Select component should use generics for
items
andchildren
. Currently, via VS Code I seechildren?: CollectionChildren<object> | undefined
Screenshots or Videos
No response
Operating System Version
macOS
Browser
Chrome