diff --git a/factoryWithTypeCheckers.js b/factoryWithTypeCheckers.js index adbd752..99daccb 100644 --- a/factoryWithTypeCheckers.js +++ b/factoryWithTypeCheckers.js @@ -206,7 +206,8 @@ module.exports = function(isValidElement, throwOnDirectAccess) { } } } - if (props[propName] == null) { + // undefined == null and null == null are true + if (props[propName] === null || props[propName] === undefined) { if (isRequired) { if (props[propName] === null) { return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.')); diff --git a/package.json b/package.json index 4440a03..b1c71ce 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,6 @@ }, "homepage": "https://facebook.github.io/react/", "dependencies": { - "loose-envify": "^1.4.0", "object-assign": "^4.1.1", "react-is": "^16.8.1" }, @@ -47,6 +46,7 @@ "eslint": "^5.13.0", "in-publish": "^2.0.0", "jest": "^19.0.2", + "loose-envify": "^1.4.0", "react": "^15.5.1", "uglifyify": "^3.0.4", "uglifyjs": "^2.4.10" diff --git a/yarn.lock b/yarn.lock index 366f1f5..b7d6128 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2339,7 +2339,7 @@ loose-envify@^1.0.0, loose-envify@^1.1.0, loose-envify@^1.3.1: loose-envify@^1.4.0: version "1.4.0" - resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.4.0.tgz#71ee51fa7be4caec1a63839f7e682d8132d30caf" + resolved "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz#71ee51fa7be4caec1a63839f7e682d8132d30caf" integrity sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q== dependencies: js-tokens "^3.0.0 || ^4.0.0"