(type, props, children)
| 19614 | } |
| 19615 | |
| 19616 | function createElementWithValidation(type, props, children) { |
| 19617 | var validType = typeof type === 'string' || typeof type === 'function' || |
| 19618 | // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill. |
| 19619 | type === REACT_FRAGMENT_TYPE || type === REACT_ASYNC_MODE_TYPE || type === REACT_STRICT_MODE_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE); |
| 19620 | |
| 19621 | // We warn in this case but don't throw. We expect the element creation to |
| 19622 | // succeed and there will likely be errors in render. |
| 19623 | if (!validType) { |
| 19624 | var info = ''; |
| 19625 | if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) { |
| 19626 | info += ' You likely forgot to export your component from the file ' + "it's defined in, or you might have mixed up default and named imports."; |
| 19627 | } |
| 19628 | |
| 19629 | var sourceInfo = getSourceInfoErrorAddendum(props); |
| 19630 | if (sourceInfo) { |
| 19631 | info += sourceInfo; |
| 19632 | } else { |
| 19633 | info += getDeclarationErrorAddendum(); |
| 19634 | } |
| 19635 | |
| 19636 | info += getStackAddendum() || ''; |
| 19637 | |
| 19638 | var typeString = void 0; |
| 19639 | if (type === null) { |
| 19640 | typeString = 'null'; |
| 19641 | } else if (Array.isArray(type)) { |
| 19642 | typeString = 'array'; |
| 19643 | } else { |
| 19644 | typeString = typeof type; |
| 19645 | } |
| 19646 | |
| 19647 | warning(false, 'React.createElement: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', typeString, info); |
| 19648 | } |
| 19649 | |
| 19650 | var element = createElement.apply(this, arguments); |
| 19651 | |
| 19652 | // The result can be nullish if a mock or a custom function is used. |
| 19653 | // TODO: Drop this when these are no longer allowed as the type argument. |
| 19654 | if (element == null) { |
| 19655 | return element; |
| 19656 | } |
| 19657 | |
| 19658 | // Skip key warning if the type isn't valid since our key validation logic |
| 19659 | // doesn't expect a non-string/function type and can throw confusing errors. |
| 19660 | // We don't want exception behavior to differ between dev and prod. |
| 19661 | // (Rendering will throw with a helpful message and as soon as the type is |
| 19662 | // fixed, the key warnings will appear.) |
| 19663 | if (validType) { |
| 19664 | for (var i = 2; i < arguments.length; i++) { |
| 19665 | validateChildKeys(arguments[i], type); |
| 19666 | } |
| 19667 | } |
| 19668 | |
| 19669 | if (type === REACT_FRAGMENT_TYPE) { |
| 19670 | validateFragmentProps(element); |
| 19671 | } else { |
| 19672 | validatePropTypes(element); |
| 19673 | } |
nothing calls this directly
no test coverage detected