(props, propName, componentName, location, propFullName, secret)
| 9220 | |
| 9221 | function createPrimitiveTypeChecker(expectedType) { |
| 9222 | function validate(props, propName, componentName, location, propFullName, secret) { |
| 9223 | var propValue = props[propName]; |
| 9224 | var propType = getPropType(propValue); |
| 9225 | if (propType !== expectedType) { |
| 9226 | // `propValue` being instance of, say, date/regexp, pass the 'object' |
| 9227 | // check, but we can offer a more precise error message here rather than |
| 9228 | // 'of type `object`'. |
| 9229 | var preciseType = getPreciseType(propValue); |
| 9230 | |
| 9231 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.')); |
| 9232 | } |
| 9233 | return null; |
| 9234 | } |
| 9235 | return createChainableTypeChecker(validate); |
| 9236 | } |
| 9237 |
no test coverage detected