-
-
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
Autocomplete expect string | string[] #35308
Comments
Same issue with the latest version. Revert to version 5.10.15 will be ok. |
@hortizgarrido @huyle2405 Can you provide a CodeSandbox reproducing the issue or a minimal code example that reproduces the problem. The issue template is a good starting point. |
useAutocomplete.d.ts default property is false |
This bug was introduced by #35275. Since that PR was merged omitting Until this bug is fixed you can fix the error by explicitly setting |
The default type of The PR #35275 I made was to fix the incorrect inferring type of export type AutocompleteValue<T, Multiple, DisableClearable, FreeSolo> = Multiple extends true
? Array<T | AutocompleteFreeSoloValueMapping<FreeSolo>>
: DisableClearable extends true
? NonNullable<T | AutocompleteFreeSoloValueMapping<FreeSolo>>
: T | null | AutocompleteFreeSoloValueMapping<FreeSolo>; Please educate me if I misunderstand somewhere. And I still can’t reproduce this problem locally, so It would be very helpful to debug it if someone could provide the code example and environment reproducing the problem. |
@fenghan34 I've replicated the issue affecting #35275 in a CodeSandbox: https://codesandbox.io/s/bold-thunder-h6zyo2. The props I included in the example are |
@gnowland Thanks! It turns out the And It hasn't been detected in TypeScript tests as |
Thanks for explaining!! I’m still a bit befuddled by complex TypeScript declarations, glad I could help define the issue for you to fix :) |
Duplicates
Latest version
Steps to reproduce 🕹
No response
Current behavior 😯
Should not have to explicitly set the type in autocomplete
Expected behavior 🤔
Upgrading to latest MUI/material version is giving errors on how the autocomplete infers the type. I use to just be able to have <Autocomplete
.... />
but now i have to put <Autocomplete ...../>
Context 🔦
Issue affects entire code. Would need major rework.
Your environment 🌎
npx @mui/envinfo
The text was updated successfully, but these errors were encountered: