(expectedType)
| 64842 | } |
| 64843 | |
| 64844 | function createPrimitiveTypeChecker(expectedType) { |
| 64845 | function validate(props, propName, componentName, location, propFullName, secret) { |
| 64846 | var propValue = props[propName]; |
| 64847 | var propType = getPropType(propValue); |
| 64848 | if (propType !== expectedType) { |
| 64849 | // `propValue` being instance of, say, date/regexp, pass the 'object' |
| 64850 | // check, but we can offer a more precise error message here rather than |
| 64851 | // 'of type `object`'. |
| 64852 | var preciseType = getPreciseType(propValue); |
| 64853 | |
| 64854 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.')); |
| 64855 | } |
| 64856 | return null; |
| 64857 | } |
| 64858 | return createChainableTypeChecker(validate); |
| 64859 | } |
| 64860 | |
| 64861 | function createAnyTypeChecker() { |
| 64862 | return createChainableTypeChecker(emptyFunction.thatReturnsNull); |
no test coverage detected
searching dependent graphs…