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): item in isItemDisabled may be undefined (fixes #1623) #1631

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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
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