[prop component] ButtonBaseProps not accepting a component property
See original GitHub issueExpected Behavior 🤔
component
property should be accepted
Current Behavior 😯
component
property is not accepted
Steps to Reproduce 🕹
const props: ButtonProps<'span'> = {
component: 'span',
^^^^^^^^^^^^^^^^^ 'component' does not exist in type ...
onClick(event: React.MouseEvent<HTMLSpanElement>) {},
};
Context 🔦
Need for integration with a third-party routing library
Your Environment 🌎
Tech | Version |
---|---|
Material-UI | v4.0.0 |
TypeScript | v4.1.0 |
Edit @eps1lon: Heavily editorialized the original issue which was inaccurate and misleading.
Most of the issue has been solved, see https://next.material-ui.com/guides/typescript/#usage-of-component-prop
Issue Analytics
- State:
- Created 4 years ago
- Reactions:45
- Comments:75 (51 by maintainers)
Top Results From Across the Web
How to extend props for Material-UI components using ...
I get the following errors: TS2323: Cannot redeclare exported variable 'Button'. TS2484: Export declaration conflicts with exported declaration ...
Read more >Section 2: Excluding Props - React TypeScript Cheatsheets
The problem we want to solve is having the HOC-wrapped-component exposing a type that reflects the reduced surface area of props - without...
Read more >material-ui/core/CHANGELOG.md - UNPKG
96, - [docs] Add Material-UI Builder to in-house ads (#23342) @mbrookes ... 795, - [Card] Fix TypeScript not recognizing "component" prop (#20179) @rart....
Read more >ButtonBase API - Material UI - MUI
Name Type Default
action ref
centerRipple bool false
children node
Read more >typescript react component type as prop - Industry Today
Property 'value' does not exist on type 'EventTarget'. ... I initially had an interface of props like so for the receiving component: type...
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 Free
Top 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
To add to this, the following doesn’t compile in TypeScript in MUIv4, but should:
error message is:
I’m using TypeScript 3.3.3, but also checked 3.4.5, and getting the same error
Is this about to be fixed or is it even considered a bug? I just copy-pasted the code from the docs for my link component with minor changes and the TS error shows up: