(props, propName, componentName, location, propFullName, secret)
| 1311 | |
| 1312 | function createPrimitiveTypeChecker(expectedType) { |
| 1313 | function validate(props, propName, componentName, location, propFullName, secret) { |
| 1314 | var propValue = props[propName]; |
| 1315 | var propType = getPropType(propValue); |
| 1316 | if (propType !== expectedType) { |
| 1317 | // `propValue` being instance of, say, date/regexp, pass the 'object' |
| 1318 | // check, but we can offer a more precise error message here rather than |
| 1319 | // 'of type `object`'. |
| 1320 | var preciseType = getPreciseType(propValue); |
| 1321 | |
| 1322 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.')); |
| 1323 | } |
| 1324 | return null; |
| 1325 | } |
| 1326 | return createChainableTypeChecker(validate); |
| 1327 | } |
| 1328 |
no test coverage detected