(props, propName, componentName, location, propFullName, secret)
| 1369 | |
| 1370 | function createPrimitiveTypeChecker(expectedType) { |
| 1371 | function validate(props, propName, componentName, location, propFullName, secret) { |
| 1372 | var propValue = props[propName]; |
| 1373 | var propType = getPropType(propValue); |
| 1374 | if (propType !== expectedType) { |
| 1375 | // `propValue` being instance of, say, date/regexp, pass the 'object' |
| 1376 | // check, but we can offer a more precise error message here rather than |
| 1377 | // 'of type `object`'. |
| 1378 | var preciseType = getPreciseType(propValue); |
| 1379 | |
| 1380 | return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.')); |
| 1381 | } |
| 1382 | return null; |
| 1383 | } |
| 1384 | return createChainableTypeChecker(validate); |
| 1385 | } |
| 1386 |
no test coverage detected