(expectedType)
| 12526 | } |
| 12527 | |
| 12528 | function createPrimitiveTypeChecker(expectedType) { |
| 12529 | function validate(props, propName, componentName, location, propFullName) { |
| 12530 | var propValue = props[propName]; |
| 12531 | var propType = getPropType(propValue); |
| 12532 | if (propType !== expectedType) { |
| 12533 | var locationName = ReactPropTypeLocationNames[location]; |
| 12534 | // `propValue` being instance of, say, date/regexp, pass the 'object' |
| 12535 | // check, but we can offer a more precise error message here rather than |
| 12536 | // 'of type `object`'. |
| 12537 | var preciseType = getPreciseType(propValue); |
| 12538 | |
| 12539 | return new Error('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.')); |
| 12540 | } |
| 12541 | return null; |
| 12542 | } |
| 12543 | return createChainableTypeChecker(validate); |
| 12544 | } |
| 12545 | |
| 12546 | function createAnyTypeChecker() { |
| 12547 | return createChainableTypeChecker(emptyFunction.thatReturns(null)); |
no test coverage detected