-
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
Typescript act() got warning 'await' has no effect on the type of this expression.
#1276
Comments
Looking at
As far as I understand the intention of async RTL does hits in the following way: /**
* Simply calls ReactDOMTestUtils.act(cb)
* If that's not available (older version of react) then it
* simply calls the given callback immediately
*/
export const act: typeof reactAct extends undefined
? (callback: () => void) => void
: typeof reactAct @qaynam Would such solution satisfy your use case? |
I'm not sure how you'd declare it in the act.ts file but the generated act.d.ts file should have these two lines
You have to also ensure that the linters will allow
Since these are valid cases where the useEffect performs an |
I referenced this bug in https://stackoverflow.com/questions/64848604/how-to-resolve-act-in-useeffect/71949404#71949404 for more complete examples |
Describe the bug
when i use act with typescript , got warning like 👇
Steps to Reproduce
@testing-library/react-native/build/act.d.ts
Versions
The text was updated successfully, but these errors were encountered: