microsoft / microsoft/TypeScript

False positive "Private field ... must be declared in an enclosing class."

オープン
#63,159 コメント 3 件 リアクション 0 件 担当者 0 名 GitHub で見る
Bug Domain: LS: TSServer
主要言語
Go
スター
111k
フォーク
14.3k
平均マージ
2日 4時間
マージ済み PR(30日)
132

説明

Type: Bug

Create two copies of the file below (e.g. ab1.js and ab2.js), and open them in two tabs.

Actual: Observe whichever file you open second to show "Private field must be declared in an enclosing class" errors on `#p` call until you close the first file.

ab1.js / ab2.js:
```javascript
class A { static #p () { } constructor () { A.#p(); } }
class B { static #p () { } constructor () { B.#p(); } }
```

Expected: No errors in either file regardless of which are open or in what order.

Seems like some sort of cross-tab state pollution.

VS Code version: Code 1.109.2 (591199df409fbf59b4b52d5ad4ee0470152a9b31, 2026-02-10T20:18:23.520Z)
OS version: Linux x64 6.12.57+deb13-amd64
Modes:
Remote OS version: Linux x64 4.19.0-22-amd64
Remote OS version: Linux x64 4.19.0-22-amd64
Remote OS version: Linux x64 4.19.0-22-amd64

System Info

|Item|Value|
|---|---|
|CPUs|Intel(R) Core(TM) i5-7400 CPU @ 3.00GHz (4 x 3299)|
|GPU Status|2d_canvas: enabled
GPU0: VENDOR= 0x8086 [Google Inc. (Intel)], DEVICE=0x5912 [ANGLE (Intel, Mesa Intel(R) HD Graphics 630 (KBL GT2), OpenGL ES 3.2 Mesa 25.0.7-2)], DRIVER_VENDOR=Mesa, DRIVER_VERSION=25.0.7 *ACTIVE*
Machine model name:
Machine model version:
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
skia_graphite: disabled_off
trees_in_viz: disabled_off
video_decode: enabled
video_encode: disabled_software
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: disabled_off
webnn: disabled_off|
|Load (avg)|1, 1, 1|
|Memory (System)|11.60GB (2.00GB free)|
|Process Argv|--crash-reporter-id 97c901d7-5d55-4f8c-b33d-38997feaf33e|
|Screen Reader|no|
|VM|0%|
|DESKTOP_SESSION|plasma|
|XDG_CURRENT_DESKTOP|KDE|
|XDG_SESSION_DESKTOP|KDE|
|XDG_SESSION_TYPE|wayland|

|Item|Value|
|---|---|
|Remote|SSH: k1.kappacs.com|
|OS|Linux x64 4.19.0-22-amd64|
|CPUs|Pentium(R) Dual-Core CPU E5800 @ 3.20GHz (2 x 1217)|
|Memory (System)|3.82GB (0.84GB free)|
|VM|0%|

|Item|Value|
|---|---|
|Remote|SSH: k1.kappacs.com|
|OS|Linux x64 4.19.0-22-amd64|
|CPUs|Pentium(R) Dual-Core CPU E5800 @ 3.20GHz (2 x 1217)|
|Memory (System)|3.82GB (0.84GB free)|
|VM|0%|

|Item|Value|
|---|---|
|Remote|SSH: k1.kappacs.com|
|OS|Linux x64 4.19.0-22-amd64|
|CPUs|Pentium(R) Dual-Core CPU E5800 @ 3.20GHz (2 x 1217)|
|Memory (System)|3.82GB (0.84GB free)|
|VM|0%|
Extensions (5)

Extension|Author (truncated)|Version
---|---|---
kilo-code|kil|5.7.0
remote-ssh|ms-|0.122.0
remote-ssh-edit|ms-|0.87.0
remote-explorer|ms-|0.5.0
vim|vsc|1.32.4

A/B Experiments

```
vsliv368cf:30146710
vswsl492:30256859
binariesv615:30325510
nativeloc1:31344060
dwcopilot:31170013
dwoutputs:31242946
copilot_t_ci:31333650
e5gg6876:31282496
pythonrdcb7:31342333
6518g693:31463988
aj953862:31281341
b6b4d950:31327385
6abeh943:31336334
envsactivate1:31464700
cloudbuttont:31379625
aihoversummaries_f:31453033
42190218_ostrepl:31403339
use-responses-api:31390855
anonusage:31403420
ec5jj548:31422691
cp_cls_c_966_ss:31454199
4je02754:31463857
find_all_ref_in_bg_t:31453034
a5gib710:31434435
7a04d226_do_not_restore_last_panel_session:31438103
cp_cls_t_1081:31454832
a43f0575b:31442825
e9c30283:31461165
idci7584:31464702
edit_mode_hidden:31461530
nostats:31457175
864ei723_large_tool_results_to_disk:31460878
notips:31457203
chat:31457767

```

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

提供された JavaScript ファイルのコピーを 2 つ、別々のタブで開いて診断を再現し、1 つ目と 2 つ目のファイルのエラーを比較します。プライベートフィールドの診断の報告に関係するタブ間の状態を追跡し、その後、開く順序に関係なく、どちらのファイルも自身の `#p` 呼び出しについてエラーを報告しないことを確認します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
javascript, typescript, vscode
領域
tooling
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
42/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。