-
Notifications
You must be signed in to change notification settings - Fork 356
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Vague error message for oneOfType #226
Comments
I'm running into this same issue. It looks like the |
Duplicate of #9. |
@ljharb #9 was closed by #198 but I'm still seeing this issue. CodeSandbox: https://codesandbox.io/s/vague-error-message-for-proptypesoneoftype-v16ft Code: function Button({ myProp, ...rest }) {
return <button {...rest} />;
}
Button.propTypes = {
myProp: PropTypes.oneOfType([
PropTypes.string,
PropTypes.number
])
};
function App() {
return (
<div className="App">
<Button myProp={["hello"]}>Hello</Button>
</div>
);
} PropTypes validation warning:
I would expect the warning to tell me that I need to pass in either a |
Type definitions
Usage
Error received
In my case, I am using react-modal, and after upgrading to new version, a new prop attribute is added.
It will be much better if we show some kinds of warnings:
I would like to improve it if you guys agree.
The text was updated successfully, but these errors were encountered: