fix: improve autocomplete typings

This commit is contained in:
Daniel Lautzenheiser 2023-08-31 11:53:53 -04:00
parent 9d0936ed54
commit e0dadaf817
2 changed files with 8 additions and 8 deletions

View File

@ -32,7 +32,7 @@ export interface AutocompleteProps<T> {
required?: boolean;
displayValue: (item: T | T[] | null) => string;
onQuery: (query: string) => void;
onChange: AutocompleteChangeEventHandler<T | undefined>;
onChange: (value: T | T[] | undefined) => void;
}
const Autocomplete = function <T>(
@ -135,9 +135,9 @@ const Autocomplete = function <T>(
`,
disabled &&
`
text-gray-300/75
dark:text-gray-600/75
`,
text-gray-300/75
dark:text-gray-600/75
`,
)}
aria-hidden="true"
/>
@ -153,9 +153,9 @@ const Autocomplete = function <T>(
`,
disabled &&
`
text-gray-300/75
dark:text-gray-600/75
`,
text-gray-300/75
dark:text-gray-600/75
`,
)}
aria-hidden="true"
/>

View File

@ -296,7 +296,7 @@ const RelationControl: FC<WidgetControlProps<string | string[], RelationField>>
const ref = useRef<HTMLButtonElement | null>(null);
const handleChange = useCallback(
(newValue: string | string[] | null) => {
(newValue: string | string[] | undefined) => {
if (!newValue) {
setInternalValue(newValue);
onChange(newValue);