[Typography] typescript error Property 'component' does not exist
See original GitHub issueThe Typography types file doesn’t have a description for the ‘component’ prop which causes a type error.
- The issue is present in the latest release.
- I have searched the issues of this repository and believe that this is not a duplicate.
Current Behavior 😯
When createing a typography component like so:
<Typography variant='h5' component='h6'>{title}</Typography>
causes typescript error:
Property ‘component’ does not exist on type 'IntrinsicAttributes & Pick…
I believe I am using Typography in a way that’s consistent with the documentation: https://v4-8-3.material-ui.com/api/typography/
Expected Behavior 🤔
As the ‘component’ prop is both in the JS code and the documentation, the typescript error should not be thrown.
It seems to me that it it’s caused but the ‘component’ prop not being described in this file (4.8.1):
However, one version earlier, it is present and correct (4.8.0): https://github.com/mui-org/material-ui/blob/v4.8.0/packages/material-ui/src/Typography/Typography.d.ts
All subsequent versions also have this property removed.
Steps to Reproduce 🕹
Steps:
- Install Material-ui/core at 4.8.1 or above
- Create a Typography component
- Add the ‘component’ prop.
- Run any kind of typescript compiler.
Your Environment 🌎
Tech | Version |
---|---|
Material-UI | v4.8.3 |
React | v16.12.0 |
Issue Analytics
- State:
- Created 3 years ago
- Reactions:3
- Comments:19 (6 by maintainers)
Top GitHub Comments
@DanMMX See the docs https://next.material-ui.com/guides/typescript/#usage-of-component-prop:
How to solve?