(props, propName, componentName, location, propFullName, secret)
| 1276 | |
| 1277 | function createPrimitiveTypeChecker(expectedType) { |
| 1278 | function validate(props, propName, componentName, location, propFullName, secret) { |
| 1279 | var propValue = props[propName]; |
| 1280 | var propType = getPropType(propValue); |
| 1281 | if (propType !== expectedType) { |
| 1282 | // `propValue` being instance of, say, date/regexp, pass the 'object' |
| 1283 | // check, but we can offer a more precise error message here rather than |
| 1284 | // 'of type `object`'. |
| 1285 | var preciseType = getPreciseType(propValue); |
| 1286 | |
| 1287 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.')); |
| 1288 | } |
| 1289 | return null; |
| 1290 | } |
| 1291 | return createChainableTypeChecker(validate); |
| 1292 | } |
| 1293 |
no test coverage detected