diff --git a/factoryWithThrowingShims.js b/factoryWithThrowingShims.js index 257f710..840f68e 100644 --- a/factoryWithThrowingShims.js +++ b/factoryWithThrowingShims.js @@ -11,11 +11,14 @@ var emptyFunction = require('fbjs/lib/emptyFunction'); var invariant = require('fbjs/lib/invariant'); +var ReactPropTypesSecret = require('./lib/ReactPropTypesSecret'); module.exports = function() { - // Important! - // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`. - function shim() { + function shim(props, propName, componentName, location, propFullName, secret) { + if (secret === ReactPropTypesSecret) { + // It is still safe when called from React. + return; + } invariant( false, 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' + @@ -27,6 +30,8 @@ module.exports = function() { function getShim() { return shim; }; + // Important! + // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`. var ReactPropTypes = { array: shim, bool: shim,