-
-
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
TS2322 Spreading declared MenuItemProps on MenuItem fails type checking #16245
Comments
This seems to be the same core issue than #16122. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
How about we refactor MenuItem to be built on top of ButtonBase, not on top of ListItem? Would it help solve this TypeScript issue? |
That would solve the issue for MenuItem specifically, but ListItem itself is broken identically. A solution which goes more to the root of the problem would be preferable. |
The problem should be resolved now that #26591 is merged (The Regarding the @SoulsD feel free to re-open if something was not addressed by the two changes mentioned above. |
Expected Behavior 🤔
MenuItemProps should be typed with correct 'button' override by default the when imported
Current Behavior 😯
from
core/MenuItem/MenuItem.d.ts
:P
parameter of menu Item props default to{}
instead of{ button?: true }
resulting in an error when you want to use it directly:To dismiss the error, type
MenuItemProps
needs to be declared like this:Steps to Reproduce 🕹
Link:
Context 🔦
I am migrating to MUIv4 from v3. I had a component taking
MenuItemProps
in its own props to be passed to its childrenMenuItem
s. I am now forced to type this asMenuItemProps<'li', { button?: true }>
.Your Environment 🌎
The text was updated successfully, but these errors were encountered: