-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
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
[useAutocomplete] Improve typeof groupOptions
in useAutocomplete
#40739
Comments
groupOptions
Type in useAutocomplete
typeof groupOptions
in useAutocomplete
Can you show an example where you needed to narrow or cast the type? Your request makes sense to me. I don't think it would cause any issues or a breaking change. Want to give it a try by making a pull request? |
typeof groupOptions
in useAutocomplete
typeof groupOptions
in useAutocomplete
@ZeeshanTamboli I'll give it a shot. Starting to look into this now 👍🏽 |
Hey @lewxdev do you still have a need for this? (or are you still interested in looking into it) |
@mj12albert I wasn't able to wrangle the types in the way that I originally outlined (when used, the Open to feedback and suggestions here: #44657 |
This issue has been closed. If you have a similar problem but not exactly the same, please open a new issue. Note @lewxdev How did we do? Your experience with our support team matters to us. If you have a moment, please share your thoughts in this short Support Satisfaction survey. |
What's the problem?
Currently, the following type is true regardless of the inputs passed in to
useAutocomplete
:Essentially, the developer has to narrow or cast the type despite MUI being able to assert the correct type definition with the inputs of the
useAutocomplete
hook. I propose addressing the type definition hereWhat are the requirements?
groupBy
is passedtypeof groupedOptions = AutocompleteGroupedOption<T>[]
groupBy
is omitted,typeof groupedOptions = T[]
What are our options?
Proposed solution
We could do something like
useAutocomplete.d.ts
Effective implementation (abbreviated)
Resources and benchmarks
This was pointed out by @spencermehta
Minimal working playground link
Search keywords:
The text was updated successfully, but these errors were encountered: