1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 | 'use strict';
|
9 |
|
10 | var ReactPropTypesSecret = require('./lib/ReactPropTypesSecret');
|
11 |
|
12 | function emptyFunction() {}
|
13 | function emptyFunctionWithReset() {}
|
14 | emptyFunctionWithReset.resetWarningCache = emptyFunction;
|
15 |
|
16 | module.exports = function() {
|
17 | function shim(props, propName, componentName, location, propFullName, secret) {
|
18 | if (secret === ReactPropTypesSecret) {
|
19 |
|
20 | return;
|
21 | }
|
22 | var err = new Error(
|
23 | 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
|
24 | 'Use PropTypes.checkPropTypes() to call them. ' +
|
25 | 'Read more at http://fb.me/use-check-prop-types'
|
26 | );
|
27 | err.name = 'Invariant Violation';
|
28 | throw err;
|
29 | };
|
30 | shim.isRequired = shim;
|
31 | function getShim() {
|
32 | return shim;
|
33 | };
|
34 |
|
35 |
|
36 | var ReactPropTypes = {
|
37 | array: shim,
|
38 | bool: shim,
|
39 | func: shim,
|
40 | number: shim,
|
41 | object: shim,
|
42 | string: shim,
|
43 | symbol: shim,
|
44 |
|
45 | any: shim,
|
46 | arrayOf: getShim,
|
47 | element: shim,
|
48 | elementType: shim,
|
49 | instanceOf: getShim,
|
50 | node: shim,
|
51 | objectOf: getShim,
|
52 | oneOf: getShim,
|
53 | oneOfType: getShim,
|
54 | shape: getShim,
|
55 | exact: getShim,
|
56 |
|
57 | checkPropTypes: emptyFunctionWithReset,
|
58 | resetWarningCache: emptyFunction
|
59 | };
|
60 |
|
61 | ReactPropTypes.PropTypes = ReactPropTypes;
|
62 |
|
63 | return ReactPropTypes;
|
64 | };
|