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

Fix lifecycle hook function types #10480

Merged
merged 1 commit into from
Sep 8, 2020
Merged

Fix lifecycle hook function types #10480

merged 1 commit into from
Sep 8, 2020

Conversation

villasv
Copy link
Contributor

@villasv villasv commented Sep 4, 2020

Summary

Fixes #10066

Test plan

Added a new type test suite for the @jest/globals to ensure lifecycle hooks are not typed as HookFn that could return Promise, but are at least functions that return void.

@jeysal jeysal requested a review from SimenB September 7, 2020 20:14
@SimenB
Copy link
Member

SimenB commented Sep 7, 2020

Ideally this'd include type tests (based on #10407), but we don't have any tests for these globals, so possibly out of scope?

@villasv
Copy link
Contributor Author

villasv commented Sep 8, 2020

Added a new test file for the globals. The test successfully fails™ before the suggested changes, but is now passing.

It doesn't test exactly what I wanted (I wanted to test the argument types, it's testing the function return types), but it does the job.

Copy link
Member

@SimenB SimenB left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wonderful, thanks! Could you update the changelog as well?

@villasv
Copy link
Contributor Author

villasv commented Sep 8, 2020

Wasn't sure where to put it, left it on the master's Fixes section.

@SimenB
Copy link
Member

SimenB commented Sep 8, 2020

Wasn't sure where to put it, left it on the master's Fixes section.

Exactly right 👍

@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incorrect types for lifecycle functions
4 participants