[Typescript] PropTypes.Color does not allow new color variants
See original GitHub issueRelated to #13875
- 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 😯
Types in packages/material-ui/src/index.d.ts
, namely PropTypes.Color
do not allow new color variants (success
, info
, warning
).
Expected Behavior 🤔
PropTypes.Color
should allow success
, info
and warning
Steps to Reproduce 🕹
Try to pass "info"
as a color to any component that supports it (none right now in master, Alert
in lab) and get a typescript warning.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:13 (11 by maintainers)
Top Results From Across the Web
[Typescript] PropTypes.Color does not allow new color variants
Try to pass "info" as a color to any component that supports it (none right now in master, Alert in lab) and get...
Read more >Material UI React Typescript - Extending Theme Colors
There is a red squiggle on 'color' because the type of the color prop doesn't have "netural" as an option.
Read more >Typechecking With PropTypes - React
To run typechecking on the props for a component, you can assign the special propTypes property: import PropTypes from 'prop-types'; class Greeting extends ......
Read more >Documenting components - React Styleguidist
Styleguidist generates documentation for your components based on the comments in your source code, propTypes declarations, and Readme files.
Read more >React, TypeScript and defaultProps dilemma | by Martin Hochel
We will annotate color and type as optional, because they will be defined via defaultProps, so consumer of our component doesn't have to...
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
@damusix Agree, it’s planned for v5 #13875.
We need to be careful with this on and check every usage if it matches the
Component.propTypes
.In the meantime you should be able to use module augmentation documented in our TypeScript guide.