-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Uses Node typings when not configured in tsconfig.json #25061
Description
From @diminutivesloop on June 15, 2018 18:51
Issue Type: Bug
When using APIs that exist in both the browser and Node.js from within TypeScript code VSCode will use the Node typings for that api even if they aren't configured in tsconfig.json.
For example my tsconfig.json includes the following options:
"typeRoots": ["node_modules/@types"],
"types": ["jasmine", "jasminewd2", "hammerjs"],
"lib": ["es2015", "dom"]
And I have the following code:
let a: number = setTimeout(()=>{}, 100);
In VSCode I get the error "Type 'Timer' is not assignable to type 'number'" in VSCode although the code compiles without error. Note that I do have a transitive dependency on @types/node but since I don't include it in my tsconfig.json VSCode should not be using it.
VS Code version: Code 1.24.1 (24f62626b222e9a8313213fb64b10d741a326288, 2018-06-13T17:51:32.889Z)
OS version: Windows_NT x64 6.1.7601
System Info
| Item | Value |
|---|---|
| CPUs | Intel(R) Core(TM) i7-4930MX CPU @ 3.00GHz (8 x 3192) |
| GPU Status | 2d_canvas: enabled flash_3d: enabled flash_stage3d: enabled flash_stage3d_baseline: enabled gpu_compositing: enabled multiple_raster_threads: enabled_on native_gpu_memory_buffers: disabled_software rasterization: disabled_software video_decode: enabled video_encode: enabled vpx_decode: unavailable_software webgl: enabled webgl2: enabled |
| Memory (System) | 31.94GB (16.26GB free) |
| Process Argv | C:\Program Files\Microsoft VS Code\Code.exe |
| Screen Reader | yes |
| VM | 0% |
Extensions (24)
| Extension | Author (truncated) | Version |
|---|---|---|
| rainbow-brackets | 2gu | 0.0.6 |
| project-manager | ale | 0.25.2 |
| ng-template | Ang | 0.1.9 |
| vscode-eslint | dba | 1.4.12 |
| find-related | eam | 0.7.0 |
| gitlens | eam | 8.3.5 |
| EditorConfig | Edi | 0.12.4 |
| tslint | eg2 | 1.0.32 |
| vscode-npm-script | eg2 | 0.3.4 |
| prettier-vscode | esb | 1.5.0 |
| todo-tree | Gru | 0.0.63 |
| java-properties | ith | 0.0.2 |
| vscode-duplicate | mrm | 1.2.1 |
| vsliveshare | ms- | 0.3.295 |
| debugger-for-chrome | msj | 4.6.0 |
| tsimporter | pmn | 1.2.14 |
| java | red | 0.26.0 |
| sass-indented | rob | 1.4.9 |
| sort-lines | Tyr | 1.7.0 |
| vscode-java-debug | vsc | 0.9.0 |
| vscode-java-pack | vsc | 0.3.0 |
| vscode-java-test | vsc | 0.6.1 |
| vscode-maven | vsc | 0.9.0 |
| vim | vsc | 0.12.0 |
(1 theme extensions excluded)
Copied from original issue: microsoft/vscode#52071