question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Typescript] PropTypes.Color does not allow new color variants

See original GitHub issue

Related 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:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:13 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
oliviertassinaricommented, Feb 27, 2020

@damusix Agree, it’s planned for v5 #13875.

1reaction
eps1loncommented, Dec 27, 2019

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found