[TypeScript] - Can't set button type attribute
See original GitHub issueTS2322: Type '{ children: Element; type: string; disabled: boolean; color: "primary" | "light"; loading: boolean; onClick: () => Promise<void>; }' is not assignable to type 'IntrinsicAttributes & ButtonProps & RefAttributes<any>'. Property 'type' does not exist on type 'IntrinsicAttributes & ButtonProps & RefAttributes<any>'.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:10 (2 by maintainers)
Top Results From Across the Web
What's the point of <button type="button">? - Stack Overflow
So setting the type to "button" disables the default behaviour of submitting a form so you won't need to use preventDefault to handle...
Read more >Useful Patterns by Use Case - React TypeScript Cheatsheets
A very common use case for this is to render something as either a button or an anchor, based on if it receives...
Read more >Your Button component should default to `type="button"`
I'm restricting the value to "submit" | undefined , so that only type="submit" is allowed. (Omitting the prop is also allowed.)
Read more >Documentation - Everyday Types - TypeScript
In this chapter, we'll cover some of the most common types of values you'll find in JavaScript code, and explain the corresponding ways...
Read more >How to disable a Button in TypeScript | bobbyhadz
Select the button element. · Use the setAttribute() method to set the disabled attribute. · For example, btn?.setAttribute('disabled', '') .
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’m using it like this
Not a bug. This should be passed as
submit
attribute. I seem to hit this repeatedly. Couldn’tButton
instead inheritButtonHTMLAttributes