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

AggregatedResult and GlobalConfig cannot be imported on older version of TS compiler #9899

Closed
sachinjoseph opened this issue Apr 27, 2020 · 4 comments

Comments

@sachinjoseph
Copy link

Previously, runCLI, AggregatedResult and GlobalConfig were exported in jest but I found that runCLI is now to be imported from @jest/core and AggregatedResult and GlobalConfig from @jest/test-result and @jest/types respectively. Because these packages use the export type syntax, it is impossible to consume these using older versions of the TypeScript compiler.

Similar issues

Jest recently published fixes for very similar issues - see #9703 and #9714.

Steps to reproduce the behavior:

import @jest/types or @jest/test-result using an older version of the TypeScript compiler. The problem is:

  • import keyword does not understand export type.
  • import type is not available in older versions of TypeScript compiler.

Expected behavior

@jest/types or @jest/test-result is import-able by a older versions of the TypeScript compiler.

Link to how these exports are currently used

See how runCLI, AggregatedResult, and GlobalConfig are used: https://github.com/microsoft/rushstack/blob/fe4019a62d4dadeba329bafa0eab46b6f7bc0e67/core-build/gulp-core-build/src/tasks/JestTask.ts#L171-L177

@SimenB
Copy link
Member

SimenB commented Apr 27, 2020

This should be fixed in the latest version, no? Do you have a code snippet that gives TS errors importing from jest@>=25.4.0?

@sachinjoseph
Copy link
Author

Sorry my bad, my lockfile was importing [email protected] for some reason. Thanks @SimenB.

@SimenB
Copy link
Member

SimenB commented Apr 27, 2020

Aha! Good news, thank you 🙂

@github-actions
Copy link

This issue 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

No branches or pull requests

2 participants