-
Notifications
You must be signed in to change notification settings - Fork 46.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
Bug: Unable to set value
of ButtonHTMLAttributes to object type
#25311
Labels
Status: Unconfirmed
A potential issue that we haven't yet confirmed as a bug
Comments
marcusjwhelan
added
the
Status: Unconfirmed
A potential issue that we haven't yet confirmed as a bug
label
Sep 22, 2022
The |
I see then it is an issue with mui.com types trying to use buttons types because thiers works and using a straight button doesn't allow an object. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
React version: Type definitions for React 18.0
Steps To Reproduce
Link to code example:
Link to example in code sandbox
The current behavior
Error Message from TS
The expected behavior
Don't give me an error for this, there are no type constraints on the value for a button.
This is causing an issue with library Material-ui (Mui.com) which uses the
interface
ButtonHTMLAttributes<T> extends HTMLAttributes<T>
which says the value can only be of typestring | ReadonlyArray<string> | number | undefined
. They use it on theirMenuItem
component which is used within theSelect
component which disallows the use of assigning an object to theMenuItem
. I can@ts-ignore
this or set the object toas any
and bypass the TS issue and the HTML works.To me if you can use
@ts-ignore
oras any
to get around a TS error there is an issue with the types applied to the attributes for the HMLT element.Please let me know if this is correct to post here or should Mui.com be responsible to not type the
MenuItem
as an extension of this interface which ultimately is preventing me from assigning the object to the value.The text was updated successfully, but these errors were encountered: