-
Notifications
You must be signed in to change notification settings - Fork 52
Consume PropTypes from the prop-types module #61
Conversation
This ensures compatibility with React 16+.
Thanks @eliperkins! We'll want to make sure this is backward compatible with React glamorous does a good job with this (paypal/glamorous#32) and would be a helpful reference |
This suppresses warnings for projects which do not include PropTypes or versions of React less than 15.5.
dfc875b
to
d9dbe0d
Compare
Codecov Report
@@ Coverage Diff @@
## master #61 +/- ##
==========================================
+ Coverage 92.02% 92.25% +0.22%
==========================================
Files 10 11 +1
Lines 138 142 +4
Branches 37 39 +2
==========================================
+ Hits 127 131 +4
Misses 7 7
Partials 4 4
Continue to review full report at Codecov.
|
@ajwhite Not sure I totally agree with adding in a compat layer. Reading the README's section on compatibility it seems like it just encourages the user to upgrade to 15.3.0+ with a warning message. I've updated it regardless, following how glamorous implemented the compat layer though! |
Yeah, I agree that it's unfavorable, but there are some some folks that are locked into earlier The section on Differences seems to indicate there is a version of React where this can actually result in an error being thrown, if I'm reading this correctly. If that's the case, I do lean towards the compat approach. |
package.json
Outdated
@@ -55,7 +55,8 @@ | |||
"semantic-release": "^6.3.6" | |||
}, | |||
"dependencies": { | |||
"brcast": "^2.0.0" | |||
"brcast": "^2.0.0", | |||
"prop-types": "^15.5.10" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Normally we might opt to put this in peerDependencies
, but since it's an optional dependency, let's follow glamorous and place this in devDependencies
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated!
8c70875
to
46aaed2
Compare
Awesome - going to just pull down and double check on a project that doesn't use |
Thanks man 💯 |
What:
Adds
prop-types
module and runs theReact-PropTypes-to-prop-types
codemodWhy:
This ensures compatibility with React 16+. Fixes
Cannot read property 'object' of undefined
on React 16.0.0-beta.1How: