Skip to content

Commit

Permalink
fix(Autocomplete): allow null for isItemSelected
Browse files Browse the repository at this point in the history
So users can use the default isItemSelected check without type warnings.
  • Loading branch information
ktmud committed Oct 27, 2020
1 parent 27e2fde commit 2bbc2ee
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/core/src/components/Autocomplete/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,9 @@ export type AutocompleteProps<T extends Item = Item> = Omit<BaseInputProps, 'id'
getItemValue?: (item: T) => string;
/** Determine if an item is selectable. Non-selectable items will be disabled in the list. */
isItemSelectable?: (item: T, selected?: boolean) => boolean;
/** Determine if an item is selected. Will compare values by default if not defined. */
isItemSelected?: (item: T, value: string) => boolean;
/** Determine if an item is selected. Always return false by default. Set
* as `null` to compare item values with the selected value. */
isItemSelected?: null | ((item: T, value: string) => boolean);
/** Load and show items with the current value when focused. */
loadItemsOnFocus?: boolean;
/** Load and show items on mount. */
Expand Down

0 comments on commit 2bbc2ee

Please sign in to comment.