-
Notifications
You must be signed in to change notification settings - Fork 273
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
fix: force cast await to proper type #1293
Conversation
|
||
function withGlobalActEnvironment(actImplementation: Act) { | ||
return (callback: Parameters<Act>[0]) => { | ||
function withGlobalActEnvironment(actImplementation: ReactAct) { |
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.
Is it even useful to pass it actImplementation
as a param?
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.
hmmmm, good question, we've got our code from RTL and just sprinkled types and eslint ignores over it.
I guess it's easier to keep it in sync with their implmentation.
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.
Left one comment, other than that LGTM
Codecov ReportBase: 95.19% // Head: 95.98% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #1293 +/- ##
==========================================
+ Coverage 95.19% 95.98% +0.78%
==========================================
Files 47 47
Lines 3249 3240 -9
Branches 489 489
==========================================
+ Hits 3093 3110 +17
+ Misses 156 130 -26
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
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.
lgtm
Summary
Resolve typing issues with
act
by allowing to invoke bothact()
andawait act()
. Reactact
has uses function overloading which is hard to work with, so I've resorted to casting.Dropping support for mock
act
and increasing peer dep req to React 16.8 (earliest version to expose act in Test Renderer). I think we can avoid calling this a breaking change, as we already specified minimal RN version of 0.59, which uses React 16.8.3 (see here)Resolves #1276
Resolves #1207
Test plan
Typecheck runs fine.