-
-
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] Fix inferred value type when multiple
prop is true
#35275
[Autocomplete] Fix inferred value type when multiple
prop is true
#35275
Conversation
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. Please add a TypeScript test case in Autocomplete.spec.tsx
.
Added, please let me know if need any changes. |
multiple
prop with true
multiple
prop is true
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a great first pull request on Material UI 👌 Thank you for working on it!
I have to set multiple explicitly to false otherwise I get TS2322: Type 'string' is not assignable to type 'string[]'. Am I doing something wrong? Should i create a Issue for that? |
I see that too. I get Type string is not assignable to string[]. For some reason i have to now include the type in my autocomplete as follows so that it works: <Autocomple .... |
Hi @LeoniakM, would you mind providing the code example so I can debug it? |
Same issue here, complaint that number / string is not assigned to (number | string)[]. I can walk-around this by adding multiple={false}. |
gives me "TS2322: Type 'string' is not assignable to type 'string[]'." |
Hi @LeoniakM, thank you for the code example. I just tested it locally and on StackBlitz, but I haven't found any issue. Seems like we are in different environments, so can you provide the environment of your codebase by executing |
Edit: I updated Node to 18, but the issue still appears. |
Example added to issue #35308 |
Fixes: #35099