diff --git a/src/utils/propTypeRequiredWrapper.js b/src/utils/propTypeRequiredWrapper.js index da57263..34f52e3 100644 --- a/src/utils/propTypeRequiredWrapper.js +++ b/src/utils/propTypeRequiredWrapper.js @@ -1,11 +1,16 @@ const checkRequiredThenValidate = (validator) => - (props, propName, componentName, ...rest) => + (props, propName, componentName, location) => { if (props[propName] !== null) { - return validator(props, propName, componentName, ...rest); + return validator(props, propName, componentName, location); } + + /* global ReactPropTypesLocationNames */ // Pacify ESLint + const location_name = ReactPropTypesLocationNames[location]; + return new Error( - `Missing prop \`${propName}\` not supplied to \`${componentName}\`` + `Required prop \`${propName}\` was not specified in ` + + `\`${componentName}\`. Check the render method of \`${location_name}\`.` ); };