From @OliverJAsh on September 26, 2018 13:23
- VSCode Version: 10.27.2
- OS Version: macOS 10.13.6
Steps to Reproduce:
Full reproduction case
- Given a
tsconfig.json that has project references, where the referenced TS projects specify a custom compilerOptions.types
- Open a file inside one of the referenced projects
Expected: VSCode should respect compilerOption.types.
Actual: VSCode appears to ignore compilerOption.types.
For example, I have three TS projects:
tsconfig-src.json which should not have jest types (compilerOption.types is set to [])
tsconfig-tests.json which should have jest types (compilerOption.types is set to ["jest"])
tsconfig.json which references both of the above
The following file is part of the tsconfig-src.json project:
// src/sum.ts
test('foo', () => {})
// Expected: error in VSCode and when running `tsc -b`
// Actual: no error in VSCode, error when running `tsc -b`
export function sum(a: number, b: number) {
return a + b;
}
When I run tsc -b -f tsconfig.json, I get the expected error:
src/sum.ts:3:1 - error TS2304: Cannot find name 'test'.
3 test('foo', () => {})
~~~~
(test is a global type provided by the jest types.)
However, VSCode has no error. Instead, the types appear to be available, even when they shouldn't:

You can try this for yourself with the provided full reproduction case.
Copied from original issue: microsoft/vscode#59466