-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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
[react-redux] Correctly infer prop types from wrapped component #28189
[react-redux] Correctly infer prop types from wrapped component #28189
Conversation
663013b
to
074d394
Compare
@apapirovski Thank you for submitting this PR! 🔔 @tkqubo @thasner @kenzierocks @clayne11 @tansongyang @NicholasBoll @mDibyo @pdeva @Kallikrein @val1984 @jrakotoharisoa - please review this PR in the next few days. Be sure to explicitly select If no reviewer appears after a week, a DefinitelyTyped maintainer will review the PR instead. |
074d394
to
699d966
Compare
A definition owner has approved this PR ⭐️. A maintainer will merge this PR shortly. If it shouldn't be merged yet, please leave a comment saying so and we'll wait. Thank you for your contribution to DefinitelyTyped! |
🔔 @tkqubo @thasner @kenzierocks @clayne11 @tansongyang @NicholasBoll @mDibyo @pdeva @Kallikrein @val1984 @jrakotoharisoa can you take a look please? |
<ConnectedComponent fn={() => {}} /> | ||
|
||
const ConnectedComponent2 = connect<MapStateProps, void, OwnProps>(mapStateToProps)(Component); | ||
<ConnectedComponent fn={() => {}} /> |
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.
Shouldn't that be <ConnectedComponent2 fn={() => {}} />
?
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.
Yes! Will fix that.
@DanielRosenwasser Looks like the bot removed the |
a380c94
to
beb67b4
Compare
@DanielRosenwasser @tkqubo @thasner @kenzierocks @clayne11 @tansongyang @NicholasBoll @mDibyo @pdeva @Kallikrein @val1984 @jrakotoharisoa Wondering if there's any chance I could get this reviewed? It's been a little while now. Thanks in advance! |
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.
Looks good, except for the comment on Matching
.
types/react-redux/index.d.ts
Outdated
* a property P will be present if: | ||
* - it is present in DecorationTargetProps | ||
* - it is present in InjectedProps[P] and can satisfy DecorationTargetProps[P] | ||
* or it is not present in InjectedProps[P] |
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.
I'm a little confused by this statement, it effectively says that P will be present if it is not present in InjectedProps?
This doesn't appear to match what the code does. Could this be cleared up?
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.
The comment is not quite correct anymore for the recently updated version. Updating right now.
@apapirovski One or more reviewers has requested changes. Please address their comments. I'll be back once they sign off or you've pushed new commits or comments. Thank you! |
@kenzierocks I've updated the comment. |
bad79f8
to
7a30679
Compare
@apapirovski The Travis CI build failed! Please review the logs for more information. Once you've pushed the fixes, the build will automatically re-run. Thanks! |
I don't think the test is related to this PR :| See #28759 |
Make sure the inferred props include the defaultProps and propTypes resolutions by using JSX.LibraryManagedAttributes.
7a30679
to
61092a2
Compare
🔔 @kenzierocks - Thanks for your review of this PR! Can you please look at the new code and update your review status if appropriate? |
@kenzierocks Any chance you have the ability to add/remove labels? This has the "revision needed" which makes it impossible to merge. Otherwise, @DanielRosenwasser? Any chance you can remove the label? |
I can't remove labels as a Contributor. You might try pushing again to re-run Travis, or if the failure is related to that PR, rebase off of master to incorporate the fix for it. |
@kenzierocks Already reran Travis. I think the bot just has a bug around the "revision needed" label. Happened to me in another PR here a while ago. I guess we wait... |
This PR has caused a few new bugs. Please can someone advise? We're not sure what the intention of |
npm test
.)npm run lint package-name
(ortsc
if notslint.json
is present).This makes sure the inferred props include the
defaultProps
andpropTypes
resolutions by usingJSX.LibraryManagedAttributes
. I don't know how people feel about usingJSX.LibraryManagedAttributes
here directly but it feels better than rewriting the same thing from scratch...This fixes #27959