MCPcopy Create free account
hub / github.com/AlloyTeam/PhyTouch / validatePropTypes

Function validatePropTypes

transformjs/react/example/index.js:3215–3227  ·  view source on GitHub ↗

* Given an element, validate that its props follow the propTypes definition, * provided by the type. * * @param {ReactElement} element

(element)

Source from the content-addressed store, hash-verified

3213 * @param {ReactElement} element
3214 */
3215 function validatePropTypes(element) {
3216 var componentClass = element.type;
3217 if (typeof componentClass !== 'function') {
3218 return;
3219 }
3220 var name = componentClass.displayName || componentClass.name;
3221 if (componentClass.propTypes) {
3222 checkReactTypeSpec(componentClass.propTypes, element.props, 'prop', name, element, null);
3223 }
3224 if (typeof componentClass.getDefaultProps === 'function') {
3225 process.env.NODE_ENV !== 'production' ? warning(componentClass.getDefaultProps.isReactClassApproved, 'getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.') : void 0;
3226 }
3227 }
3228
3229 var ReactElementValidator = {
3230

Callers 1

index.jsFile · 0.85

Calls 1

checkReactTypeSpecFunction · 0.85

Tested by

no test coverage detected