This repository has been archived by the owner on Sep 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 358
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 |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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: