Skip to content

Commit

Permalink
Fix false positive when mixing DEV and PROD builds
Browse files Browse the repository at this point in the history
  • Loading branch information
gaearon committed May 12, 2017
1 parent 659c123 commit 118249e
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions factoryWithThrowingShims.js
Expand Up @@ -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. ' +
Expand All @@ -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,
Expand Down

0 comments on commit 118249e

Please sign in to comment.