1 | 'use strict';
|
2 |
|
3 | exports.__esModule = true;
|
4 |
|
5 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
6 |
|
7 | var _react = require('react');
|
8 |
|
9 | var _react2 = _interopRequireDefault(_react);
|
10 |
|
11 | var _common = require('./common');
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 | function validate(props, propName, componentName) {
|
27 | var errBeginning = _common.errMsg(props, propName, componentName, '. Expected an Element `type`');
|
28 |
|
29 | if (typeof props[propName] !== 'function') {
|
30 | if (_react2['default'].isValidElement(props[propName])) {
|
31 | return new Error(errBeginning + ', not an actual Element');
|
32 | }
|
33 |
|
34 | if (typeof props[propName] !== 'string') {
|
35 | return new Error(errBeginning + ' such as a tag name or return value of React.createClass(...)');
|
36 | }
|
37 | }
|
38 | }
|
39 |
|
40 | exports['default'] = _common.createChainableTypeChecker(validate);
|
41 | module.exports = exports['default']; |
\ | No newline at end of file |