-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
prop-types does mark nested destructured props as being used #296
Comments
Nested prop-types are supported since |
Ahh so it would seem. I was doing |
Not for now, but I can consider this possibility. |
In version For example, |
I have also confirmed that dot-accessed nested props are checked but nested destructured props are not. Here's a repro case: function Foo(props) {
const { bar: { nope } } = props;
return <div test={nope} />;
}
Foo.propTypes = {
foo: PropTypes.number,
bar: PropTypes.shape({
faz: PropTypes.number,
qaz: PropTypes.object,
}),
}; @ianmstew don't worry about opening a new issue, I'll just modify this one. |
Assume I have a propTypes as follows:
I would want accessing
this.props.bar.faz
to not generate an error, whilethis.props.bar.nope
to generate an error.This may be tricky because
PropTypes.shape
is technically a black box, but when used with something likerecursive
from https://github.com/kolodny/zan it would make senseThe text was updated successfully, but these errors were encountered: