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

chore: do not bundle type definitions for packages which have only one .d.ts file #12718

Merged
merged 1 commit into from
Apr 23, 2022
Merged

chore: do not bundle type definitions for packages which have only one .d.ts file #12718

merged 1 commit into from
Apr 23, 2022

Conversation

mrazauskas
Copy link
Contributor

Summary

What if type definitions of packages which have only one .d.ts file would not be bundled?

First, there is nothing to bundle. Second, that could be an elegant workaround for: https://github.com/facebook/jest/blob/3c6f14bc51a857bb0baf8e6ff7af43aaf47951e9/packages/jest-expect/src/types.ts#L19-L20

In this case the problem was that the bundler is simply discarding declare module 'expect' declaration. An attempt to have jest.Mocked was hitting the same problem, because declare namespace jest was also thrown away. jest.Mocked declaration must live inside @jest/globals, which is just one tiny file. That’s why I though: wait, what is the bundler doing here? ;D

Test plan

Green CI.

@mrazauskas
Copy link
Contributor Author

Hm.. This part of the script does not run on definition files which are not bundled (should it be split into separate step, perhaps?):

https://github.com/facebook/jest/blob/3c6f14bc51a857bb0baf8e6ff7af43aaf47951e9/scripts/bundleTs.mjs#L160-L195

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! we don't need that snippet you linked in this case since we no longer mess with tsc's output

@SimenB SimenB merged commit a28db24 into jestjs:main Apr 23, 2022
@mrazauskas mrazauskas deleted the chore-tweak-bundleTs branch April 23, 2022 09:45
SimenB pushed a commit that referenced this pull request Apr 24, 2022
F3n67u pushed a commit to F3n67u/jest that referenced this pull request May 2, 2022
F3n67u pushed a commit to F3n67u/jest that referenced this pull request May 2, 2022
@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 24, 2022
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