(props, propName, componentName, location, propFullName, secret)
| 1527 | |
| 1528 | function createPrimitiveTypeChecker(expectedType) { |
| 1529 | function validate(props, propName, componentName, location, propFullName, secret) { |
| 1530 | var propValue = props[propName]; |
| 1531 | var propType = getPropType(propValue); |
| 1532 | if (propType !== expectedType) { |
| 1533 | // `propValue` being instance of, say, date/regexp, pass the 'object' |
| 1534 | // check, but we can offer a more precise error message here rather than |
| 1535 | // 'of type `object`'. |
| 1536 | var preciseType = getPreciseType(propValue); |
| 1537 | |
| 1538 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.')); |
| 1539 | } |
| 1540 | return null; |
| 1541 | } |
| 1542 | return createChainableTypeChecker(validate); |
| 1543 | } |
| 1544 |
no test coverage detected