Do you want to request a feature or report a bug?
Report a bug
What is the current behavior?
When installing the types from @types/jest, webpack throws the following error when started:
ERROR in [at-loader] ./node_modules/@types/jest/index.d.ts:1026:34
TS2304: Cannot find name 'Set'.
error Command failed with exit code 2.
The line referred is onRunComplete?(contexts: Set<Context>, results: AggregatedResult): Maybe<Promise<void>>; which, as the error states, cannot run because apparently Set does not exists
If the current behavior is a bug, please provide the steps to reproduce and either a repl.it demo through https://repl.it/languages/jest or a minimal repository on GitHub that we can yarn install and yarn test.
The repo with the minimal packages and code required to reproduce the bug is https://github.com/GabrielDuarteM/jest-types-test
You just have to run yarn start
Note that the test that i placed there does not work because i would have to add the libraries required to transpile the tests to typescript before run, and that would add more packages that are not required to reproduce the bug, so i opted to leave it as it is now.
What is the expected behavior?
The expected behavior would be @types/jest library getting transpiled with no errors
Please provide your exact Jest configuration and mention your Jest, node, yarn/npm version and operating system.
Jest configuration: The default one
Jest version: 20.0.4
@types/jest version: 20.0.4
Node version: 8.1.1
yarn version: 0.27.5
npm version: 5.3.0
OS: Windows 10
EDIT
Apparently, @types/[email protected] is working, but from @20.0.4 and onwards, the error occurs.
It's my changes in DefinitelyTyped not in the Jest repo, adding lib: ['es6'] or skipLibCheck: true to your tsconfig can fix this problem (Jest internally uses Set, which is a part of es6).
And also, this question is not belong to this repo, Jest itself only maintains the flow-type definition.
Ah, my bad, i thought that it was maintained at this repo too because of the typescript example they have put at their docs here.
When i get home, gonna try adding those configs to the tsconfig
Most helpful comment
It's my changes in DefinitelyTyped not in the Jest repo, adding
lib: ['es6']orskipLibCheck: trueto your tsconfig can fix this problem (Jest internally usesSet, which is a part of es6).And also, this question is not belong to this repo, Jest itself only maintains the flow-type definition.