Closed
Description
Type: Bug
On certain actions VS Code forgets the module declarations for modules it just knew seconds earlier, giving errors such as Cannot find module 'package-a' or its corresponding type declarations. ts(2307)
. Building using tsc --build
works without issues, so I assume the TSServer is the issue.
The following repository demonstrates the problem in packages/package-b/src/index.ts
:
https://github.com/FunkMonkey/ts-language-server-bug
Steps to reproduce:
- Open
packages/package-b/src/index.ts
(no problems shown) - Change the import slightly, e.g. from
import { FOO } from "package-a";
toimport { FOO } from "package-aX";
(shows an error about not finding type declarations, which is obviously correct) - Change the import back to
import { FOO } from "package-a";
- VS Code is showing a wrong error:
Cannot find module 'package-a' or its corresponding type declarations. ts(2307)
, even after saving - Use the VS Code command
Typescript: Restart TS Server
- Module declarations of
package-a
are properly found again
Additional details:
- Project is a monorepo that uses project references. Since this pull request, TS can use the source code instead of built
d.ts
files, so it should properly find the the declarations (partially does that) - moduleResolution
bundler
and package.jsonexports
are used
VS Code version: Code 1.80.1 (74f6148eb9ea00507ec113ec51c489d6ffb4b771, 2023-07-12T17:22:07.651Z)
OS version: Windows_NT x64 10.0.19044
Modes:
System Info
Item | Value |
---|---|
CPUs | AMD Ryzen 5 1600X Six-Core Processor (12 x 3593) |
GPU Status | 2d_canvas: enabled canvas_oop_rasterization: disabled_off direct_rendering_display_compositor: disabled_off_ok gpu_compositing: enabled multiple_raster_threads: enabled_on opengl: enabled_on rasterization: enabled raw_draw: disabled_off_ok video_decode: enabled video_encode: enabled vulkan: disabled_off webgl: enabled webgl2: enabled webgpu: enabled |
Load (avg) | undefined |
Memory (System) | 15.93GB (5.91GB free) |
Process Argv | --crash-reporter-id 70e2feda-04a5-4ccd-be16-d245907437fd |
Screen Reader | no |
VM | 0% |
Extensions (39)
Extension | Author (truncated) | Version |
---|---|---|
vscode-nginx-conf | ahm | 0.1.3 |
Bookmarks | ale | 13.4.1 |
vscode-zipfs | arc | 3.0.0 |
gltf-vscode | ces | 2.4.0 |
vscode-eslint | dba | 2.4.2 |
EditorConfig | Edi | 0.16.4 |
vscode-typescript-exportallmodules | eli | 2.6.0 |
prettier-vscode | esb | 9.19.0 |
vscode-back-forward-button | gri | 0.1.6 |
toggle-panel | hea | 1.2.0 |
vscode-drawio | hed | 1.6.6 |
autohotkey-debug | hel | 0.7.1 |
workspacesort | ici | 1.6.2 |
json-compact-prettifier | ina | 1.3.10 |
vscode-env | Iro | 0.1.0 |
jbockle-format-files | jbo | 3.4.0 |
unity-code-snippets | kle | 1.3.0 |
node-module-intellisense | lei | 1.5.0 |
regionfolder | map | 1.0.22 |
vscode-autohotkey-plus-plus | mar | 3.3.2 |
git-graph | mhu | 1.30.0 |
isort | ms- | 2023.10.1 |
python | ms- | 2023.12.0 |
vscode-pylance | ms- | 2023.7.30 |
jupyter | ms- | 2023.6.1101941928 |
jupyter-keymap | ms- | 1.1.2 |
jupyter-renderers | ms- | 1.0.17 |
vscode-jupyter-cell-tags | ms- | 0.1.8 |
vscode-jupyter-slideshow | ms- | 0.1.5 |
remote-wsl | ms- | 0.80.2 |
cmake-tools | ms- | 1.14.34 |
abracadabra | nic | 8.1.1 |
r-debugger | RDe | 0.5.4 |
r | REd | 2.8.1 |
nunjucks | ron | 0.3.1 |
dot | Ste | 0.0.1 |
graphviz-interactive-preview | tin | 0.3.5 |
unity-tools | Tob | 1.2.12 |
cmake | twx | 0.0.17 |
A/B Experiments
vsliv368:30146709
vsreu685:30147344
python383:30185418
vspor879:30202332
vspor708:30202333
vspor363:30204092
vslsvsres303:30308271
vserr242cf:30382550
pythontb:30283811
vsjup518:30340749
pythonptprofiler:30281270
vshan820:30294714
vstes263:30335439
vscoreces:30445986
vscod805cf:30301675
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
vsaa593:30376534
pythonvs932:30410667
py29gd2263:30792226
vsclangdf:30486550
c4g48928:30535728
dsvsc012cf:30540253
pynewext54:30695312
azure-dev_surveyone:30548225
2e4cg342:30602488
89544117:30613380
a9j8j154:30646983
showlangstatbar:30737416
vsctsb:30748421
03d35959:30757346
pythonfmttext:30731395
pythoncmvfstrcf:30756944
fixshowwlkth:30771522
showindicator:30785052
pythongtdpath:30769146
i26e3531:30792625
pythonnosmt12:30779714
pythonidxpt:30784022
pythonnoceb:30776495
e537b577:30795824
dsvsc013:30795093
dsvsc014cf:30791936