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
[@types/react] button refuses its own props #36505
Comments
I think what you're probably looking for is |
Jake has it right. It might even be easier to do |
I had the most success using |
So is |
So |
In my case, type of the props was almost likely incorrect after partially spreading these props. export const Button: Overload = ({
color = 'primary',
className,
href,
...rest
}: ButtonProps | AnchorProps) => {
// here, in ...rest, "type" property of the button will be "string | undefined".
} So I had to force the rest-spreaded props like this: <button className={clx} style={style} {...rest as ButtonProps}>
{children}
</button> |
Works for me: React.ButtonHTMLAttributes<HTMLButtonElement> |
Incorrect seems like a stretch since you're saying it could also be |
As another workaround: |
If you're using |
I found this issue for the same reason and this work for me
|
Thank you! |
Is there a preferred type method?
It seems from the comments above that the |
@types/react
package and had problems.Definitions by:
inindex.d.ts
) so they can respond.The text was updated successfully, but these errors were encountered: