Skip to content
This repository was archived by the owner on Jul 30, 2020. It is now read-only.

Update type of act to support async act #65

Merged
merged 1 commit into from
Oct 10, 2019

Conversation

jeffreyffs
Copy link
Contributor

What:

Changed type of act to support async act.

Why:

If you try to do this in Typescript:

    await act(async () => {
      await wait();
    });

TSLint will complain about 'redundant await on non-promise value' because act is currently typed as:

export const act: (callback: () => void) => void;

How:

Try and important react-test-renderer's version of act. If it exists we can use its type (it supports both async and non-async act), otherwise fall back to the previous definition.

Checklist:

  • Documentation added to the
    docs site
  • Typescript definitions updated
  • Tests
  • Ready to be merged

@bcarroll22
Copy link
Collaborator

Awesome, thanks!

@bcarroll22 bcarroll22 merged commit 00d11da into testing-library:master Oct 10, 2019
@jeffreyffs
Copy link
Contributor Author

Fastest PR of all time! 🎉

@codecov
Copy link

codecov bot commented Oct 10, 2019

Codecov Report

Merging #65 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@          Coverage Diff          @@
##           master    #65   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files          20     20           
  Lines         266    266           
  Branches       67     67           
=====================================
  Hits          266    266

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 169dd88...465a031. Read the comment docs.

@bcarroll22
Copy link
Collaborator

🎉 This PR is included in version 4.0.14 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

2 participants