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>(

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);