Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(type): Nullable setHighlightedIndex #1559

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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. |
Expand Down
6 changes: 3 additions & 3 deletions typings/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ export interface Actions<Item> {
cb?: Callback,
) => void
setHighlightedIndex: (
index: number,
index: number | null,
otherStateToSet?: Partial<StateChangeOptions<Item>>,
cb?: Callback,
) => void
Expand Down Expand Up @@ -459,7 +459,7 @@ export interface UseSelectActions<Item> {
closeMenu: () => void
toggleMenu: () => void
selectItem: (item: Item | null) => void
setHighlightedIndex: (index: number) => void
setHighlightedIndex: (index: number | null) => void
}

export type UseSelectReturnValue<Item> = UseSelectState<Item> &
Expand Down Expand Up @@ -666,7 +666,7 @@ export interface UseComboboxActions<Item> {
closeMenu: () => void
toggleMenu: () => void
selectItem: (item: Item | null) => void
setHighlightedIndex: (index: number) => void
setHighlightedIndex: (index: number | null) => void
setInputValue: (inputValue: string) => void
}

Expand Down