diff --git a/README.md b/README.md index 8b5ca04a0..54807e997 100644 --- a/README.md +++ b/README.md @@ -906,7 +906,7 @@ These are functions you can call to change the state of the downshift component. | `selectHighlightedItem` | `function(otherStateToSet: object, cb: Function)` | selects the item that is currently highlighted | | `selectItem` | `function(item: any, otherStateToSet: object, cb: Function)` | selects the given item | | `selectItemAtIndex` | `function(index: number, otherStateToSet: object, cb: Function)` | selects the item at the given index | -| `setHighlightedIndex` | `function(index: number, otherStateToSet: object, cb: Function)` | call to set a new highlighted index | +| `setHighlightedIndex` | `function(index: number | null, otherStateToSet: object, cb: Function)` | call to set a new highlighted index | | `toggleMenu` | `function(otherStateToSet: object, cb: Function)` | toggle the menu open state | | `reset` | `function(otherStateToSet: object, cb: Function)` | this resets downshift's state to a reasonable default | | `setItemCount` | `function(count: number)` | this sets the `itemCount`. Handy in situations where you're using windowing and the items are loaded asynchronously from within downshift (so you can't use the `itemCount` prop. | diff --git a/typings/index.d.ts b/typings/index.d.ts index 7b4302a7f..9add1bb08 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -255,7 +255,7 @@ export interface Actions { cb?: Callback, ) => void setHighlightedIndex: ( - index: number, + index: number | null, otherStateToSet?: Partial>, cb?: Callback, ) => void @@ -459,7 +459,7 @@ export interface UseSelectActions { closeMenu: () => void toggleMenu: () => void selectItem: (item: Item | null) => void - setHighlightedIndex: (index: number) => void + setHighlightedIndex: (index: number | null) => void } export type UseSelectReturnValue = UseSelectState & @@ -666,7 +666,7 @@ export interface UseComboboxActions { closeMenu: () => void toggleMenu: () => void selectItem: (item: Item | null) => void - setHighlightedIndex: (index: number) => void + setHighlightedIndex: (index: number | null) => void setInputValue: (inputValue: string) => void }