(props, propName, componentName, location, propFullName, secret)
| 30620 | |
| 30621 | function createPrimitiveTypeChecker(expectedType) { |
| 30622 | function validate(props, propName, componentName, location, propFullName, secret) { |
| 30623 | var propValue = props[propName]; |
| 30624 | var propType = getPropType(propValue); |
| 30625 | if (propType !== expectedType) { |
| 30626 | // `propValue` being instance of, say, date/regexp, pass the 'object' |
| 30627 | // check, but we can offer a more precise error message here rather than |
| 30628 | // 'of type `object`'. |
| 30629 | var preciseType = getPreciseType(propValue); |
| 30630 | |
| 30631 | return new PropTypeError( |
| 30632 | 'Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'), |
| 30633 | {expectedType: expectedType} |
| 30634 | ); |
| 30635 | } |
| 30636 | return null; |
| 30637 | } |
| 30638 | return createChainableTypeChecker(validate); |
| 30639 | } |
| 30640 |
no test coverage detected