Skip to content
This repository has been archived by the owner on Sep 1, 2024. It is now read-only.

Fix false positive when mixing DEV and PROD builds #50

Merged
merged 1 commit into from
May 12, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions factoryWithThrowingShims.js
Original file line number Diff line number Diff line change
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