Closed marksmccann closed 4 years ago
No, “age” is correct - it matches the code above it in the same section.
Fair enough, I am sure you no better than I, but are you sure? In the source, that argument is labeled as the location
, it even gives the example of "prop" in the description.
/**
* Assert that the values match with the type specs.
* Error messages are memorized and will only be shown once.
*
* @param {object} typeSpecs Map of name to a ReactPropType
* @param {object} values Runtime values that need to be type-checked
* @param {string} location e.g. "prop", "context", "child context"
* @param {string} componentName Name of the component for error messages.
* @param {?Function} getStack Returns the component stack.
* @private
*/
function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
...
var err = Error((componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' ...);
I believe, if you ran your example it would produce this:
Warning: Failed age type: Invalid age `age` of type `string` supplied to
instead of this:
Warning: Failed prop type: Invalid prop `age` of type `string` supplied to
ahh, I see what you mean :-D and also why the mistake was made in #248 - which should be reverted.
I see you have a help wanted
tag on the issue, if possible, I would love to make the update and create the PR for you.
That’d be great; that’s indeed what the label means.
I believe there is a small typo in the
PropTypes.checkPropTypes
section of yourREADME.md
. Not a big deal, but wanted to point it out. It tripped me up for a little bit and wanted save the next person some time :).It reads:
When I believe it should read: