MCPcopy Create free account
hub / github.com/plotly/dash / createPrimitiveTypeChecker

Function createPrimitiveTypeChecker

dash/deps/prop-types@15.8.1.js:402–420  ·  view source on GitHub ↗
(expectedType)

Source from the content-addressed store, hash-verified

400 }
401
402 function createPrimitiveTypeChecker(expectedType) {
403 function validate(props, propName, componentName, location, propFullName, secret) {
404 var propValue = props[propName];
405 var propType = getPropType(propValue);
406 if (propType !== expectedType) {
407 // `propValue` being instance of, say, date/regexp, pass the 'object'
408 // check, but we can offer a more precise error message here rather than
409 // 'of type `object`'.
410 var preciseType = getPreciseType(propValue);
411
412 return new PropTypeError(
413 'Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'),
414 {expectedType: expectedType}
415 );
416 }
417 return null;
418 }
419 return createChainableTypeChecker(validate);
420 }
421
422 function createAnyTypeChecker() {
423 return createChainableTypeChecker(emptyFunctionThatReturnsNull);

Callers 1

Calls 1

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…