Hacky thin wrapper to add introspection to React prop-types
This is a very thin layer around the prop-types package, to add introspection support, by setting a field called
introspection on all created propTypes. This only handles the
prop-types package. If you are using other packages (like
react-immutable-proptypes), those must also be replaced.
- Add as dependency:
yarn add introspectable-proptypesor
npm install introspectable-proptypes
- Import component:
import PropTypes from "introspectable-proptypes";
- Use as before.
MyComponent.propTypes.introspectionnow contains a readable version of the propType.