[Menu] MenuItem improperly inherits from Reacts Button type when it shouldn't especially when used in Select #34440
Labels
bug 🐛
Something doesn't work
component: menu
This is the name of the generic UI component, not the React module!
package: material-ui
Specific to @mui/material
typescript
Duplicates
Latest version
Steps to reproduce 🕹
Steps:
Current behavior 😯
This error on MenuItem when trying to assign an Object to the value
Expected behavior 🤔
Not give me a typescript error about the value not conforming to React's button value typing when the component is not a value.
Context 🔦
I am attempting to use an array of objects for my select list. I am attempting to set the value to an object.
Setting the value to
as any
gets rid of the problem which to me means there is a bug with the way the component is typed.In my example codeSandbox you will see a button being used with a proper error of an object being used for the value which it is true you cannot do this. facebook/react#25311
While on the MenuItem I can and it works so the types are wrong.
Here is a link to the codeSandbox. https://codesandbox.io/s/kind-pateu-pdfin6?file=/src/index.tsx
Add in
as any
on the value and the error goes away.Your environment 🌎
npx @mui/envinfo
The text was updated successfully, but these errors were encountered: