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

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

Closed
OliverJAsh opened this issue Sep 26, 2018 · 2 comments
Closed
Assignees
Labels
typescript Typescript support issues

Comments

@OliverJAsh
Copy link
Contributor

OliverJAsh commented Sep 26, 2018

  • 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.

@vscodebot vscodebot bot added the typescript Typescript support issues label Sep 26, 2018
@OliverJAsh
Copy link
Contributor Author

Actually, this might not be confined to compilerOptions.types. I've also noticed other compiler options like noImplicitReturns are not respected.

@mjbvz
Copy link
Collaborator

mjbvz commented Sep 26, 2018

This issue was moved to microsoft/TypeScript#27372

@mjbvz mjbvz closed this as completed Sep 26, 2018
@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 10, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
typescript Typescript support issues
Projects
None yet
Development

No branches or pull requests

2 participants