Skip to content
This repository has been archived by the owner on Sep 1, 2024. It is now read-only.

Commit

Permalink
checkPropTypes: Friendlier message when using a type checker that i…
Browse files Browse the repository at this point in the history
…s not a function
  • Loading branch information
Gregory Desfour authored and ljharb committed May 13, 2017
1 parent 604da17 commit e341666
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion checkPropTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
if (typeof typeSpecs[typeSpecName] !== 'function') {
var err = Error(
(componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' +
'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.'
'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' +
'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.
);
err.name = 'Invariant Violation';
throw err;
Expand Down

0 comments on commit e341666

Please sign in to comment.