[ui][typeahead] fix nullable prop (#492)

This commit is contained in:
Jeff Sieu
2022-11-02 21:35:31 +08:00
committed by GitHub
parent ea57743cfe
commit 47bc5fb154
6 changed files with 16 additions and 17 deletions

View File

@@ -29,17 +29,25 @@ type Props = Readonly<{
isLabelHidden?: boolean;
label: string;
noResultsMessage?: string;
nullable?: boolean;
onQueryChange: (
value: string,
event: React.ChangeEvent<HTMLInputElement>,
) => void;
onSelect: (option: TypeaheadOption | null) => void;
options: ReadonlyArray<TypeaheadOption>;
textSize?: TypeaheadTextSize;
value?: TypeaheadOption | null;
}> &
Readonly<Attributes>;
Readonly<Attributes> &
(
| {
nullable: true;
onSelect: (option: TypeaheadOption | null) => void;
}
| {
nullable?: false;
onSelect: (option: TypeaheadOption) => void;
}
);
type State = 'error' | 'normal';