-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Closed
Labels
Description
Version
28.1.1
Steps to reproduce
- 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 - Open
node_modules/jest-runtime/build/index.d.ts
- 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:
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