ec317b50b10d6d51a657d6f0ce314803608d590ec5c6b66750de514c8efc40ca093f93b7853b80a52b27e64476f65314c64affea3cec18418dd393bee322db 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610
  1. /**
  2. * Copyright (c) 2013-present, Facebook, Inc.
  3. *
  4. * This source code is licensed under the MIT license found in the
  5. * LICENSE file in the root directory of this source tree.
  6. */
  7. 'use strict';
  8. var ReactIs = require('react-is');
  9. var assign = require('object-assign');
  10. var ReactPropTypesSecret = require('./lib/ReactPropTypesSecret');
  11. var has = require('./lib/has');
  12. var checkPropTypes = require('./checkPropTypes');
  13. var printWarning = function() {};
  14. if (process.env.NODE_ENV !== 'production') {
  15. printWarning = function(text) {
  16. var message = 'Warning: ' + text;
  17. if (typeof console !== 'undefined') {
  18. console.error(message);
  19. }
  20. try {
  21. // --- Welcome to debugging React ---
  22. // This error was thrown as a convenience so that you can use this stack
  23. // to find the callsite that caused this warning to fire.
  24. throw new Error(message);
  25. } catch (x) {}
  26. };
  27. }
  28. function emptyFunctionThatReturnsNull() {
  29. return null;
  30. }
  31. module.exports = function(isValidElement, throwOnDirectAccess) {
  32. /* global Symbol */
  33. var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
  34. var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
  35. /**
  36. * Returns the iterator method function contained on the iterable object.
  37. *
  38. * Be sure to invoke the function with the iterable as context:
  39. *
  40. * var iteratorFn = getIteratorFn(myIterable);
  41. * if (iteratorFn) {
  42. * var iterator = iteratorFn.call(myIterable);
  43. * ...
  44. * }
  45. *
  46. * @param {?object} maybeIterable
  47. * @return {?function}
  48. */
  49. function getIteratorFn(maybeIterable) {
  50. var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
  51. if (typeof iteratorFn === 'function') {
  52. return iteratorFn;
  53. }
  54. }
  55. /**
  56. * Collection of methods that allow declaration and validation of props that are
  57. * supplied to React components. Example usage:
  58. *
  59. * var Props = require('ReactPropTypes');
  60. * var MyArticle = React.createClass({
  61. * propTypes: {
  62. * // An optional string prop named "description".
  63. * description: Props.string,
  64. *
  65. * // A required enum prop named "category".
  66. * category: Props.oneOf(['News','Photos']).isRequired,
  67. *
  68. * // A prop named "dialog" that requires an instance of Dialog.
  69. * dialog: Props.instanceOf(Dialog).isRequired
  70. * },
  71. * render: function() { ... }
  72. * });
  73. *
  74. * A more formal specification of how these methods are used:
  75. *
  76. * type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)
  77. * decl := ReactPropTypes.{type}(.isRequired)?
  78. *
  79. * Each and every declaration produces a function with the same signature. This
  80. * allows the creation of custom validation functions. For example:
  81. *
  82. * var MyLink = React.createClass({
  83. * propTypes: {
  84. * // An optional string or URI prop named "href".
  85. * href: function(props, propName, componentName) {
  86. * var propValue = props[propName];
  87. * if (propValue != null && typeof propValue !== 'string' &&
  88. * !(propValue instanceof URI)) {
  89. * return new Error(
  90. * 'Expected a string or an URI for ' + propName + ' in ' +
  91. * componentName
  92. * );
  93. * }
  94. * }
  95. * },
  96. * render: function() {...}
  97. * });
  98. *
  99. * @internal
  100. */
  101. var ANONYMOUS = '<<anonymous>>';
  102. // Important!
  103. // Keep this list in sync with production version in `./factoryWithThrowingShims.js`.
  104. var ReactPropTypes = {
  105. array: createPrimitiveTypeChecker('array'),
  106. bigint: createPrimitiveTypeChecker('bigint'),
  107. bool: createPrimitiveTypeChecker('boolean'),
  108. func: createPrimitiveTypeChecker('function'),
  109. number: createPrimitiveTypeChecker('number'),
  110. object: createPrimitiveTypeChecker('object'),
  111. string: createPrimitiveTypeChecker('string'),
  112. symbol: createPrimitiveTypeChecker('symbol'),
  113. any: createAnyTypeChecker(),
  114. arrayOf: createArrayOfTypeChecker,
  115. element: createElementTypeChecker(),
  116. elementType: createElementTypeTypeChecker(),
  117. instanceOf: createInstanceTypeChecker,
  118. node: createNodeChecker(),
  119. objectOf: createObjectOfTypeChecker,
  120. oneOf: createEnumTypeChecker,
  121. oneOfType: createUnionTypeChecker,
  122. shape: createShapeTypeChecker,
  123. exact: createStrictShapeTypeChecker,
  124. };
  125. /**
  126. * inlined Object.is polyfill to avoid requiring consumers ship their own
  127. * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
  128. */
  129. /*eslint-disable no-self-compare*/
  130. function is(x, y) {
  131. // SameValue algorithm
  132. if (x === y) {
  133. // Steps 1-5, 7-10
  134. // Steps 6.b-6.e: +0 != -0
  135. return x !== 0 || 1 / x === 1 / y;
  136. } else {
  137. // Step 6.a: NaN == NaN
  138. return x !== x && y !== y;
  139. }
  140. }
  141. /*eslint-enable no-self-compare*/
  142. /**
  143. * We use an Error-like object for backward compatibility as people may call
  144. * PropTypes directly and inspect their output. However, we don't use real
  145. * Errors anymore. We don't inspect their stack anyway, and creating them
  146. * is prohibitively expensive if they are created too often, such as what
  147. * happens in oneOfType() for any type before the one that matched.
  148. */
  149. function PropTypeError(message, data) {
  150. this.message = message;
  151. this.data = data && typeof data === 'object' ? data: {};
  152. this.stack = '';
  153. }
  154. // Make `instanceof Error` still work for returned errors.
  155. PropTypeError.prototype = Error.prototype;
  156. function createChainableTypeChecker(validate) {
  157. if (process.env.NODE_ENV !== 'production') {
  158. var manualPropTypeCallCache = {};
  159. var manualPropTypeWarningCount = 0;
  160. }
  161. function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
  162. componentName = componentName || ANONYMOUS;
  163. propFullName = propFullName || propName;
  164. if (secret !== ReactPropTypesSecret) {
  165. if (throwOnDirectAccess) {
  166. // New behavior only for users of `prop-types` package
  167. var err = new Error(
  168. 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
  169. 'Use `PropTypes.checkPropTypes()` to call them. ' +
  170. 'Read more at http://fb.me/use-check-prop-types'
  171. );
  172. err.name = 'Invariant Violation';
  173. throw err;
  174. } else if (process.env.NODE_ENV !== 'production' && typeof console !== 'undefined') {
  175. // Old behavior for people using React.PropTypes
  176. var cacheKey = componentName + ':' + propName;
  177. if (
  178. !manualPropTypeCallCache[cacheKey] &&
  179. // Avoid spamming the console because they are often not actionable except for lib authors
  180. manualPropTypeWarningCount < 3
  181. ) {
  182. printWarning(
  183. 'You are manually calling a React.PropTypes validation ' +
  184. 'function for the `' + propFullName + '` prop on `' + componentName + '`. This is deprecated ' +
  185. 'and will throw in the standalone `prop-types` package. ' +
  186. 'You may be seeing this warning due to a third-party PropTypes ' +
  187. 'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.'
  188. );
  189. manualPropTypeCallCache[cacheKey] = true;
  190. manualPropTypeWarningCount++;
  191. }
  192. }
  193. }
  194. if (props[propName] == null) {
  195. if (isRequired) {
  196. if (props[propName] === null) {
  197. return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));
  198. }
  199. return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));
  200. }
  201. return null;
  202. } else {
  203. return validate(props, propName, componentName, location, propFullName);
  204. }
  205. }
  206. var chainedCheckType = checkType.bind(null, false);
  207. chainedCheckType.isRequired = checkType.bind(null, true);
  208. return chainedCheckType;
  209. }
  210. function createPrimitiveTypeChecker(expectedType) {
  211. function validate(props, propName, componentName, location, propFullName, secret) {
  212. var propValue = props[propName];
  213. var propType = getPropType(propValue);
  214. if (propType !== expectedType) {
  215. // `propValue` being instance of, say, date/regexp, pass the 'object'
  216. // check, but we can offer a more precise error message here rather than
  217. // 'of type `object`'.
  218. var preciseType = getPreciseType(propValue);
  219. return new PropTypeError(
  220. 'Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'),
  221. {expectedType: expectedType}
  222. );
  223. }
  224. return null;
  225. }
  226. return createChainableTypeChecker(validate);
  227. }
  228. function createAnyTypeChecker() {
  229. return createChainableTypeChecker(emptyFunctionThatReturnsNull);
  230. }
  231. function createArrayOfTypeChecker(typeChecker) {
  232. function validate(props, propName, componentName, location, propFullName) {
  233. if (typeof typeChecker !== 'function') {
  234. return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');
  235. }
  236. var propValue = props[propName];
  237. if (!Array.isArray(propValue)) {
  238. var propType = getPropType(propValue);
  239. return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
  240. }
  241. for (var i = 0; i < propValue.length; i++) {
  242. var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret);
  243. if (error instanceof Error) {
  244. return error;
  245. }
  246. }
  247. return null;
  248. }
  249. return createChainableTypeChecker(validate);
  250. }
  251. function createElementTypeChecker() {
  252. function validate(props, propName, componentName, location, propFullName) {
  253. var propValue = props[propName];
  254. if (!isValidElement(propValue)) {
  255. var propType = getPropType(propValue);
  256. return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));
  257. }
  258. return null;
  259. }
  260. return createChainableTypeChecker(validate);
  261. }
  262. function createElementTypeTypeChecker() {
  263. function validate(props, propName, componentName, location, propFullName) {
  264. var propValue = props[propName];
  265. if (!ReactIs.isValidElementType(propValue)) {
  266. var propType = getPropType(propValue);
  267. return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement type.'));
  268. }
  269. return null;
  270. }
  271. return createChainableTypeChecker(validate);
  272. }
  273. function createInstanceTypeChecker(expectedClass) {
  274. function validate(props, propName, componentName, location, propFullName) {
  275. if (!(props[propName] instanceof expectedClass)) {
  276. var expectedClassName = expectedClass.name || ANONYMOUS;
  277. var actualClassName = getClassName(props[propName]);
  278. return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
  279. }
  280. return null;
  281. }
  282. return createChainableTypeChecker(validate);
  283. }
  284. function createEnumTypeChecker(expectedValues) {
  285. if (!Array.isArray(expectedValues)) {
  286. if (process.env.NODE_ENV !== 'production') {
  287. if (arguments.length > 1) {
  288. printWarning(
  289. 'Invalid arguments supplied to oneOf, expected an array, got ' + arguments.length + ' arguments. ' +
  290. 'A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).'
  291. );
  292. } else {
  293. printWarning('Invalid argument supplied to oneOf, expected an array.');
  294. }
  295. }
  296. return emptyFunctionThatReturnsNull;
  297. }
  298. function validate(props, propName, componentName, location, propFullName) {
  299. var propValue = props[propName];
  300. for (var i = 0; i < expectedValues.length; i++) {
  301. if (is(propValue, expectedValues[i])) {
  302. return null;
  303. }
  304. }
  305. var valuesString = JSON.stringify(expectedValues, function replacer(key, value) {
  306. var type = getPreciseType(value);
  307. if (type === 'symbol') {
  308. return String(value);
  309. }
  310. return value;
  311. });
  312. return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + String(propValue) + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
  313. }
  314. return createChainableTypeChecker(validate);
  315. }
  316. function createObjectOfTypeChecker(typeChecker) {
  317. function validate(props, propName, componentName, location, propFullName) {
  318. if (typeof typeChecker !== 'function') {
  319. return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');
  320. }
  321. var propValue = props[propName];
  322. var propType = getPropType(propValue);
  323. if (propType !== 'object') {
  324. return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
  325. }
  326. for (var key in propValue) {
  327. if (has(propValue, key)) {
  328. var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
  329. if (error instanceof Error) {
  330. return error;
  331. }
  332. }
  333. }
  334. return null;
  335. }
  336. return createChainableTypeChecker(validate);
  337. }
  338. function createUnionTypeChecker(arrayOfTypeCheckers) {
  339. if (!Array.isArray(arrayOfTypeCheckers)) {
  340. process.env.NODE_ENV !== 'production' ? printWarning('Invalid argument supplied to oneOfType, expected an instance of array.') : void 0;
  341. return emptyFunctionThatReturnsNull;
  342. }
  343. for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
  344. var checker = arrayOfTypeCheckers[i];
  345. if (typeof checker !== 'function') {
  346. printWarning(
  347. 'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' +
  348. 'received ' + getPostfixForTypeWarning(checker) + ' at index ' + i + '.'
  349. );
  350. return emptyFunctionThatReturnsNull;
  351. }
  352. }
  353. function validate(props, propName, componentName, location, propFullName) {
  354. var expectedTypes = [];
  355. for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
  356. var checker = arrayOfTypeCheckers[i];
  357. var checkerResult = checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret);
  358. if (checkerResult == null) {
  359. return null;
  360. }
  361. if (checkerResult.data && has(checkerResult.data, 'expectedType')) {
  362. expectedTypes.push(checkerResult.data.expectedType);
  363. }
  364. }
  365. var expectedTypesMessage = (expectedTypes.length > 0) ? ', expected one of type [' + expectedTypes.join(', ') + ']': '';
  366. return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`' + expectedTypesMessage + '.'));
  367. }
  368. return createChainableTypeChecker(validate);
  369. }
  370. function createNodeChecker() {
  371. function validate(props, propName, componentName, location, propFullName) {
  372. if (!isNode(props[propName])) {
  373. return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
  374. }
  375. return null;
  376. }
  377. return createChainableTypeChecker(validate);
  378. }
  379. function invalidValidatorError(componentName, location, propFullName, key, type) {
  380. return new PropTypeError(
  381. (componentName || 'React class') + ': ' + location + ' type `' + propFullName + '.' + key + '` is invalid; ' +
  382. 'it must be a function, usually from the `prop-types` package, but received `' + type + '`.'
  383. );
  384. }
  385. function createShapeTypeChecker(shapeTypes) {
  386. function validate(props, propName, componentName, location, propFullName) {
  387. var propValue = props[propName];
  388. var propType = getPropType(propValue);
  389. if (propType !== 'object') {
  390. return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
  391. }
  392. for (var key in shapeTypes) {
  393. var checker = shapeTypes[key];
  394. if (typeof checker !== 'function') {
  395. return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
  396. }
  397. var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
  398. if (error) {
  399. return error;
  400. }
  401. }
  402. return null;
  403. }
  404. return createChainableTypeChecker(validate);
  405. }
  406. function createStrictShapeTypeChecker(shapeTypes) {
  407. function validate(props, propName, componentName, location, propFullName) {
  408. var propValue = props[propName];
  409. var propType = getPropType(propValue);
  410. if (propType !== 'object') {
  411. return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
  412. }
  413. // We need to check all keys in case some are required but missing from props.
  414. var allKeys = assign({}, props[propName], shapeTypes);
  415. for (var key in allKeys) {
  416. var checker = shapeTypes[key];
  417. if (has(shapeTypes, key) && typeof checker !== 'function') {
  418. return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
  419. }
  420. if (!checker) {
  421. return new PropTypeError(
  422. 'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' +
  423. '\nBad object: ' + JSON.stringify(props[propName], null, ' ') +
  424. '\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ')
  425. );
  426. }
  427. var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
  428. if (error) {
  429. return error;
  430. }
  431. }
  432. return null;
  433. }
  434. return createChainableTypeChecker(validate);
  435. }
  436. function isNode(propValue) {
  437. switch (typeof propValue) {
  438. case 'number':
  439. case 'string':
  440. case 'undefined':
  441. return true;
  442. case 'boolean':
  443. return !propValue;
  444. case 'object':
  445. if (Array.isArray(propValue)) {
  446. return propValue.every(isNode);
  447. }
  448. if (propValue === null || isValidElement(propValue)) {
  449. return true;
  450. }
  451. var iteratorFn = getIteratorFn(propValue);
  452. if (iteratorFn) {
  453. var iterator = iteratorFn.call(propValue);
  454. var step;
  455. if (iteratorFn !== propValue.entries) {
  456. while (!(step = iterator.next()).done) {
  457. if (!isNode(step.value)) {
  458. return false;
  459. }
  460. }
  461. } else {
  462. // Iterator will provide entry [k,v] tuples rather than values.
  463. while (!(step = iterator.next()).done) {
  464. var entry = step.value;
  465. if (entry) {
  466. if (!isNode(entry[1])) {
  467. return false;
  468. }
  469. }
  470. }
  471. }
  472. } else {
  473. return false;
  474. }
  475. return true;
  476. default:
  477. return false;
  478. }
  479. }
  480. function isSymbol(propType, propValue) {
  481. // Native Symbol.
  482. if (propType === 'symbol') {
  483. return true;
  484. }
  485. // falsy value can't be a Symbol
  486. if (!propValue) {
  487. return false;
  488. }
  489. // 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol'
  490. if (propValue['@@toStringTag'] === 'Symbol') {
  491. return true;
  492. }
  493. // Fallback for non-spec compliant Symbols which are polyfilled.
  494. if (typeof Symbol === 'function' && propValue instanceof Symbol) {
  495. return true;
  496. }
  497. return false;
  498. }
  499. // Equivalent of `typeof` but with special handling for array and regexp.
  500. function getPropType(propValue) {
  501. var propType = typeof propValue;
  502. if (Array.isArray(propValue)) {
  503. return 'array';
  504. }
  505. if (propValue instanceof RegExp) {
  506. // Old webkits (at least until Android 4.0) return 'function' rather than
  507. // 'object' for typeof a RegExp. We'll normalize this here so that /bla/
  508. // passes PropTypes.object.
  509. return 'object';
  510. }
  511. if (isSymbol(propType, propValue)) {
  512. return 'symbol';
  513. }
  514. return propType;
  515. }
  516. // This handles more types than `getPropType`. Only used for error messages.
  517. // See `createPrimitiveTypeChecker`.
  518. function getPreciseType(propValue) {
  519. if (typeof propValue === 'undefined' || propValue === null) {
  520. return '' + propValue;
  521. }
  522. var propType = getPropType(propValue);
  523. if (propType === 'object') {
  524. if (propValue instanceof Date) {
  525. return 'date';
  526. } else if (propValue instanceof RegExp) {
  527. return 'regexp';
  528. }
  529. }
  530. return propType;
  531. }
  532. // Returns a string that is postfixed to a warning about an invalid type.
  533. // For example, "undefined" or "of type array"
  534. function getPostfixForTypeWarning(value) {
  535. var type = getPreciseType(value);
  536. switch (type) {
  537. case 'array':
  538. case 'object':
  539. return 'an ' + type;
  540. case 'boolean':
  541. case 'date':
  542. case 'regexp':
  543. return 'a ' + type;
  544. default:
  545. return type;
  546. }
  547. }
  548. // Returns class name of the object, if any.
  549. function getClassName(propValue) {
  550. if (!propValue.constructor || !propValue.constructor.name) {
  551. return ANONYMOUS;
  552. }
  553. return propValue.constructor.name;
  554. }
  555. ReactPropTypes.checkPropTypes = checkPropTypes;
  556. ReactPropTypes.resetWarningCache = checkPropTypes.resetWarningCache;
  557. ReactPropTypes.PropTypes = ReactPropTypes;
  558. return ReactPropTypes;
  559. };