-
-
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] groupBy suddenly seems required instead of optional when using as generic component #45044
Comments
Is the type addition:
intentional, and shouldn't it be, or removed at all. because
i have zero clues why this whole complexity is added in the first place, since it was correctly typed... |
@maapteh Please share a live reproduction via CodeSandbox or StackBlitz. Screenshots or code snippets alone are insufficient to diagnose the issue. Regarding PR #44657:
This behavior is documented in the Could you clarify the exact issue you're facing? A minimal live reproduction will help us assist you better.
The For example:
It’s designed to enforce correct typing dynamically based on |
Now I understand at least why the change is made. and based if groupBy was provided we cast it indeed, which is so so as well. But now i see not how i can have an optional prop suddenly required still when using a generic wrapper component for it. I will change it into: So basically when you created a generic wrapper for this component with T, you do not get the benefits of the improved typings, only when you use one single component. Clear. |
@maapteh Yes correct. Should we close this issue then? I don't think there's any improvement that can be done on your custom component, unfortunately. |
No its just an unhappy side effect of making a generic re-usable auto-complete. Thanks for your clarification Zeeshan! |
This issue has been closed. If you have a similar problem but not exactly the same, please open a new issue. Note @maapteh 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. |
Steps to reproduce
In PR #44657 it seems that the optional prop suddenly is typed as required. Since we wrap our own components with MUI inside now we have this issue. Its in the
useAutocomplete
.Current behavior
i get this error:
Expected behavior
In for example 6.1.9 it resulted in the correct optional prop:
Context
No response
Your environment
npx @mui/envinfo
Search keywords: groupBy, autocomplete
The text was updated successfully, but these errors were encountered: