diff --git a/factoryWithTypeCheckers.js b/factoryWithTypeCheckers.js index 35ec03c..ac2aee9 100644 --- a/factoryWithTypeCheckers.js +++ b/factoryWithTypeCheckers.js @@ -8,6 +8,7 @@ 'use strict'; var assign = require('object-assign'); +var has = require('has'); var ReactPropTypesSecret = require('./lib/ReactPropTypesSecret'); var checkPropTypes = require('./checkPropTypes'); @@ -318,7 +319,7 @@ module.exports = function(isValidElement, throwOnDirectAccess) { return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.')); } for (var key in propValue) { - if (Object.prototype.hasOwnProperty.call(propValue, key)) { + if (has(propValue, key)) { var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret); if (error instanceof Error) { return error; diff --git a/package.json b/package.json index c06a16c..98e5cea 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,8 @@ "homepage": "https://facebook.github.io/react/", "dependencies": { "loose-envify": "^1.3.1", - "object-assign": "^4.1.1" + "object-assign": "^4.1.1", + "has": "^1.0.1" }, "scripts": { "test": "jest", diff --git a/yarn.lock b/yarn.lock index 3ab3ab7..8392691 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1239,7 +1239,7 @@ has-flag@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-1.0.0.tgz#9d9e793165ce017a00f00418c43f942a7b1d11fa" -has@^1.0.0: +has@^1.0.0, has@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/has/-/has-1.0.1.tgz#8461733f538b0837c9361e39a9ab9e9704dc2f28" dependencies: