Currently this results in a warning but shouldn't:
Button.propTypes = {
...Touchable.propTypes,
color: PropTypes.string
}
The error message could also be improved to explain why using another component's propTypes is bad. For example: "Using propTypes from another component is not safe because they may be removed in production builds".
Comments via @gaearon on this issue: https://github.com/facebookincubator/create-react-app/pull/3818
I think that by default, it definitely should warn on it; however, I'd be open to adding an option that explicitly allowed this case.
Something like allowPropTypesInPropTypes? Or is that too confusing?
allowPropTypesComposition?
Also, how do you feel about softening the error message a bit?
I wouldn't call it "softening"; just making it more accurate :-) but yes, I'm also open to that.
For an option name, allowInPropTypes? (since it's already a subset of "foreign propTypes")
Sounds good to me. I'll work on implementing this change.
Most helpful comment
I wouldn't call it "softening"; just making it more accurate :-) but yes, I'm also open to that.
For an option name,
allowInPropTypes? (since it's already a subset of "foreign propTypes")