How to use the checkPropTypes function from prop-types
Find comprehensive JavaScript prop-types.checkPropTypes code examples handpicked from public code repositorys.
208 209 210 211 212 213 214 215 216
It will throw an error: ``` Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. ``` (If you see **a warning** rather than an error with this message, please check the [above section about compatibility](#compatibility).)
6 7 8 9 10 11 12 13 14 15
* @return {*} component return */ function withPropTypeChecks (component) { return (props) => { if (component.propTypes) { PropTypes.checkPropTypes( component.propTypes, props, 'prop', component.name
GitHub: jimczj/issue-helper

104 105 106 107 108 109 110 111 112
program .command('validate') .description('Validate the config.js conforms to the specification') .action(function () { const config = require(path.join(process.cwd(), 'config.js')) PropTypes.checkPropTypes(configPropTypes, config) }) program.parse(process.argv)
GitHub: bntzio/ink

7 8 9 10 11 12 13 14 15 16
const checkPropTypes = (component, props) => { if (process.env.NODE_ENV !== 'production' && typeof component.propTypes === 'object') { const name = component.displayName || component.name; PropTypes.checkPropTypes(component.propTypes, props, 'prop', name); } }; const getProps = vnode => Object.assign({}, vnode.component.defaultProps, vnode.props);
18 19 20 21 22 23 24 25 26 27
shopStore: new MemoryStrategy(), accessMode: 'offline' }; module.exports = function shopify(shopifyConfig) { PropTypes.checkPropTypes(ShopifyConfigTypes, shopifyConfig, 'option', 'ShopifyExpress'); const config = Object.assign({}, defaults, shopifyConfig); return {
42 43 44 45 46 47 48 49 50 51
} } const typePropTypes = TYPES[type].propTypes; PropTypes.checkPropTypes(typePropTypes, forwardedProps, "prop", type); const COMPONENTS = { StaticCanvas: () => new StaticCanvas(ref, forwardedProps), Canvas: () => new Canvas(ref, forwardedProps),
prop-types.default is the most popular function in prop-types (2947 examples)