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

[Bug]: [email protected] has incorrect build/index.d.ts #12948

Closed
blixt opened this issue Jun 17, 2022 · 2 comments · Fixed by #12949
Closed

[Bug]: [email protected] has incorrect build/index.d.ts #12948

blixt opened this issue Jun 17, 2022 · 2 comments · Fixed by #12949

Comments

@blixt
Copy link

blixt commented Jun 17, 2022

Version

28.1.1

Steps to reproduce

  1. Install jest in a TypeScript project
    a. mkdir jest-bug && cd jest-bug
    b. yarn init (hit enter until done)
    c. yarn add typescript jest
    d. yarn run tsc --init
    e. Open your favorite editor that can use the LSP of the currently installed TS
  2. Open node_modules/jest-runtime/build/index.d.ts
  3. Note that there is a type error in this file

Expected behavior

No type errors.

Actual behavior

The code in the .d.ts file has:

import type * as JestGlobals from '@jest/globals';

// …

declare class Runtime {
  // …
  setGlobalsForRuntime(globals: JestGlobals): void;
}

This is a type error because the import becomes a namespace:

Screen Shot 2022-06-17 at 19 03 48

Additional context

This happens with TypeScript 4.7.3 at least. It's failing type checks in one of our projects (though I suspect we have a misconfiguration to fail on third-party code types like this).

Environment

System:
    OS: macOS 12.4
    CPU: (16) x64 Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz
  Binaries:
    Node: 18.3.0 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 8.11.0 - /usr/local/bin/npm
  npmPackages:
    jest: ^28.1.1 => 28.1.1
@mrazauskas
Copy link
Contributor

Thanks for report. I can see the same problem in build files.

@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 Jul 22, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants