(props, propName, componentName, location, propFullName, secret)
| 1414 | |
| 1415 | function createPrimitiveTypeChecker(expectedType) { |
| 1416 | function validate(props, propName, componentName, location, propFullName, secret) { |
| 1417 | var propValue = props[propName]; |
| 1418 | var propType = getPropType(propValue); |
| 1419 | if (propType !== expectedType) { |
| 1420 | // `propValue` being instance of, say, date/regexp, pass the 'object' |
| 1421 | // check, but we can offer a more precise error message here rather than |
| 1422 | // 'of type `object`'. |
| 1423 | var preciseType = getPreciseType(propValue); |
| 1424 | |
| 1425 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.')); |
| 1426 | } |
| 1427 | return null; |
| 1428 | } |
| 1429 | return createChainableTypeChecker(validate); |
| 1430 | } |
| 1431 |
no test coverage detected