-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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
[joy-ui][Autocomplete] Typescript & React runtime error using Autocomplete #39219
Comments
@Onurfesci Thanks for reporting this ~ I can reproduce it in our docs example |
I have the same issue as above |
I will take a look tomorrow. |
Based on the CodeSandbox you provided, I guess there is something wrong with CodeSandbox because I copied the code and put it in my local react-vite (from scratch) + Joy UI without any type errors. Could you provide the code that you use in your local project? |
@siriwatknp you can check on this codesandbox, press f12, click on the dropdown icon and the error will occur |
I tried but what's the error that I should see? Is it related to this issue? |
Looks like a similar issue to #39474 Though I can't reproduce the issue with Joy anymore (even with Next.js like in @sang-au's sandbox) https://codesandbox.io/p/sandbox/sleepy-liskov-fvjhmf?file=%2Fsrc%2Fapp%2Fpage.tsx%3A1%2C1-21%2C1 |
I copied my implementation as-is to codesandbox, but I'm not seeing the same issues that I'm seeing on my VSCode. Really strange... Sandbox repro (No TS Errors): https://codesandbox.io/s/billowing-smoke-vpcn32?file=/src/Demo.tsx Local VSCode (Getting type errors on 3 props: Type error on getOptionLabel (Thinks option is the option or a string?): Notes:
Does anybody have an idea why this is happening? Could it be a |
I got the codesandbox above to show some TS errors now. Basically, if the value a
|
I think so, this would let developers gain more control over the types they want. Since this is related to Base UI |
This is already being tracked in #23708. |
Duplicates
Latest version
Steps to reproduce 🕹
Trying to use Joy UI's Autocomplete in a controlled state as per the docs, I get a TypeScript error:
I also get a runtime error on the browser from React.
I've tried passing objects with
value
andlabel
as options, passing avalue
prop, but I also get the same typescript error. It expects it to be an array ofstring
or the inferred type from option. I also get errors if I pass it an array.Am I using this component wrong, or is there an issue with these types?
Reproduction:
(MUI Joy's own example has type errors)
https://codesandbox.io/s/cp2zmj?file=/Demo.tsx
Current behavior 😯
No response
Expected behavior 🤔
No response
Context 🔦
No response
Your environment 🌎
npx @mui/envinfo
The text was updated successfully, but these errors were encountered: