autocomplete
<Autocomplete
{...field}
options={statusOptions}
multiple
onChange={(, value) => {
if (Array.isArray(value)) {
field.onChange(value.map((p) => p.value ?? p));
} else {
field.onChange([]);
}
}}
isOptionEqualToValue={(option, value) =>
value === undefined ||
option?.value?.toString() ===
(value?.value ?? value)?.toString()
}
renderInput={(params) => (
<TextField
/>
)}
/>
help me, im getting this error:
Type '{ options: { value: string; label: string; }[]; multiple: true; onChange: (: SyntheticEvent<Element, Event>, value: { value: string; label: string; }[]) => void; ... 6 more ...; ref: RefCallBack; }' is not assignable to type 'AutocompleteProps<{ value: string; label: string; }, true, false, false, "div">'.
Types of property 'value' are incompatible.
Type 'string[]' is not assignable to type '{ value: string; label: string; }[]'.
Type 'string' is not assignable to type '{ value: string; label: string; }'.ts(2322)
(alias) function Autocomplete<Value, Multiple extends boolean | undefined = false, DisableClearable extends boolean | undefined = false, FreeSolo extends boolean | undefined = false, ChipComponent extends React.ElementType<any> = "div">(props: AutocompleteProps<Value, Multiple, DisableClearable, FreeSolo, ChipComponent>): JSX.Element
import Autocomplete
{...field}
options={statusOptions}
multiple
onChange={(, value) => {
if (Array.isArray(value)) {
field.onChange(value.map((p) => p.value ?? p));
} else {
field.onChange([]);
}
}}
isOptionEqualToValue={(option, value) =>
value === undefined ||
option?.value?.toString() ===
(value?.value ?? value)?.toString()
}
renderInput={(params) => (
<TextField
/>
)}
/>
help me, im getting this error:
Type '{ options: { value: string; label: string; }[]; multiple: true; onChange: (: SyntheticEvent<Element, Event>, value: { value: string; label: string; }[]) => void; ... 6 more ...; ref: RefCallBack; }' is not assignable to type 'AutocompleteProps<{ value: string; label: string; }, true, false, false, "div">'.
Types of property 'value' are incompatible.
Type 'string[]' is not assignable to type '{ value: string; label: string; }[]'.
Type 'string' is not assignable to type '{ value: string; label: string; }'.ts(2322)
(alias) function Autocomplete<Value, Multiple extends boolean | undefined = false, DisableClearable extends boolean | undefined = false, FreeSolo extends boolean | undefined = false, ChipComponent extends React.ElementType<any> = "div">(props: AutocompleteProps<Value, Multiple, DisableClearable, FreeSolo, ChipComponent>): JSX.Element
import Autocomplete
