Skip to content
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 declaration of act should match React 16.9.x #436

Closed
davidje13 opened this issue Aug 11, 2019 · 1 comment · Fixed by #438
Closed

typescript declaration of act should match React 16.9.x #436

davidje13 opened this issue Aug 11, 2019 · 1 comment · Fixed by #438
Assignees
Labels

Comments

@davidje13
Copy link

Since 16.9.0 was released with a fix for facebook/react#14769, act returns a Promise (and optionally takes in a Promise).

This line should be updated to allow this, or better yet, it should forward the type typeof act from @types/react-dom (see here, though I'm not sure if that's 100% correct since I think it is now allowed to pass in a promise).

Right now the workaround is to import act directly from react-dom (since act here is just a pass-through), or to define:

function asyncAct(fn: () => Promise<any> | void): Promise<void> {
  return act(fn) as any as Promise<void>;
}
@kentcdodds
Copy link
Member

🎉 This issue has been resolved in version 9.1.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants