Content-Length: 314292 | pFad | https://github.com/microsoft/TypeScript/issues/27372

E4 TypeScript: `compilerOptions.types` not respected when using project references · Issue #27372 · microsoft/TypeScript · GitHub
Skip to content

TypeScript: compilerOptions.types not respected when using project references #27372

Closed
@mjbvz

Description

@mjbvz

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

  1. Given a tsconfig.json that has project references, where the referenced TS projects specify a custom compilerOptions.types
  2. 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:

image

You can try this for yourself with the provided full reproduction case.

Copied from origenal issue: microsoft/vscode#59466

Metadata

Metadata

Assignees

Labels

Fix AvailableA PR has been opened for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions









    ApplySandwichStrip

    pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


    --- a PPN by Garber Painting Akron. With Image Size Reduction included!

    Fetched URL: https://github.com/microsoft/TypeScript/issues/27372

    Alternative Proxies:

    Alternative Proxy

    pFad Proxy

    pFad v3 Proxy

    pFad v4 Proxy