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

feat(jest-mock): Export Mock, MockInstance, SpyInstance types #10138

Merged
merged 1 commit into from
Jun 23, 2020

Conversation

anilanar
Copy link
Contributor

@anilanar anilanar commented Jun 6, 2020

Summary

I'm maintaining a utility library that eases module mocking for TS projects: https://github.com/userlike/joke

While trying to fix @userlike/joke to be compatible with Jest 26, I've noticed that:

  1. @types/jest is not needed anymore.
  2. Although fn and spyOn are part of the public API, their return types are not directly exported. They can be indirectly acquired via ReturnType, but that causes loss of generic types. I see no reason why those types should not be exported as they are already part of the public contract.

So I modified jest-mock package to export Mock, MockInstance and SpyInstance types.

@anilanar anilanar force-pushed the export-mock-types branch from 11a4e2f to 3b08935 Compare June 6, 2020 14:40
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.

thanks!

@SimenB SimenB merged commit 95b94e8 into jestjs:master Jun 23, 2020
sauravhiremath pushed a commit to MLH-Fellowship/jest that referenced this pull request Jul 20, 2020
@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.

3 participants