(expectedType)
| 3911 | } |
| 3912 | |
| 3913 | function createPrimitiveTypeChecker(expectedType) { |
| 3914 | function validate(props, propName, componentName, location, propFullName, secret) { |
| 3915 | var propValue = props[propName]; |
| 3916 | var propType = getPropType(propValue); |
| 3917 | if (propType !== expectedType) { |
| 3918 | var locationName = ReactPropTypeLocationNames[location]; |
| 3919 | // `propValue` being instance of, say, date/regexp, pass the 'object' |
| 3920 | // check, but we can offer a more precise error message here rather than |
| 3921 | // 'of type `object`'. |
| 3922 | var preciseType = getPreciseType(propValue); |
| 3923 | |
| 3924 | return new PropTypeError('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.')); |
| 3925 | } |
| 3926 | return null; |
| 3927 | } |
| 3928 | return createChainableTypeChecker(validate); |
| 3929 | } |
| 3930 | |
| 3931 | function createAnyTypeChecker() { |
| 3932 | return createChainableTypeChecker(emptyFunction.thatReturns(null)); |
no test coverage detected