Skip to content

fix(type): item in isItemDisabled may be undefined (fixes #1623)#1631

Open
KrzysztofKarol wants to merge 1 commit intodownshift-js:masterfrom
KrzysztofKarol:fix/item-in-isItemDisabled-may-be-undefined
Open

fix(type): item in isItemDisabled may be undefined (fixes #1623)#1631
KrzysztofKarol wants to merge 1 commit intodownshift-js:masterfrom
KrzysztofKarol:fix/item-in-isItemDisabled-may-be-undefined

Conversation

@KrzysztofKarol
Copy link

@KrzysztofKarol KrzysztofKarol commented Jan 3, 2025

What:

Typings changed. Item in isItemDisabled may be undefined, e. g.

props.isItemDisabled(props.items[highlightedIndex], highlightedIndex)

Why:

Developers should handle this case to avoid runtime errors.

How:

Only typings changed.

Checklist:

  • Documentation
  • Tests
  • TypeScript Types
  • Flow Types
  • Ready to be merged

Fixes #1623

Offtopic
Probably types of others methods should be check and fixed
e.g.

-itemToString?: (item: Item | null) => string
+itemToString?: (item: Item | undefined) => string

because

inputValue: props.itemToString(props.items[highlightedIndex]),

@KrzysztofKarol KrzysztofKarol changed the title fix(type): item in isItemDisabled may be undefined fix(type): item in isItemDisabled may be undefined (fixes #1623) Jan 3, 2025
@KrzysztofKarol
Copy link
Author

Is there anything I can do to help?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

useCombobox: HighlightedIndex and Items are not in sync

1 participant