(expectedType)
| 12607 | } |
| 12608 | |
| 12609 | function createPrimitiveTypeChecker(expectedType) { |
| 12610 | function validate(props, propName, componentName, location, propFullName) { |
| 12611 | var propValue = props[propName]; |
| 12612 | var propType = getPropType(propValue); |
| 12613 | if (propType !== expectedType) { |
| 12614 | var locationName = ReactPropTypeLocationNames[location]; |
| 12615 | // `propValue` being instance of, say, date/regexp, pass the 'object' |
| 12616 | // check, but we can offer a more precise error message here rather than |
| 12617 | // 'of type `object`'. |
| 12618 | var preciseType = getPreciseType(propValue); |
| 12619 | |
| 12620 | return new Error('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.')); |
| 12621 | } |
| 12622 | return null; |
| 12623 | } |
| 12624 | return createChainableTypeChecker(validate); |
| 12625 | } |
| 12626 | |
| 12627 | function createAnyTypeChecker() { |
| 12628 | return createChainableTypeChecker(emptyFunction.thatReturns(null)); |
no test coverage detected
searching dependent graphs…