microsoft / microsoft/TypeScript
[TypeScript] Rename Symbol doesn't work as expected with Declaration Merging
まだ誰も着手していません。
- 主要言語
- Go
- スター
- 111k
- フォーク
- 14.3k
- 平均マージ
- 2日 4時間
- マージ済み PR(30日)
- 132
説明
Type: Bug
Does this issue occur when all extensions are disabled?: Yes
When renaming symbols in TypeScript, the feature doesn't take into account declaration merging. As a result, renaming symbols breaks references. Renaming the subsequent symbols to match does not fix the references. Whether the imports are explicit or default seems to have no effect.
Steps to Reproduce:
1. Create a class and a namespace with the same name, export them
2. Import the merged symbol in another file, use references to both the class and namespace
3. Attempt to rename the original class & namespace without breaking the references
```typescript
// file: MyWonderfulClass.class.ts
export class MyWonderfulClass {
// Absolutely wonderful things
}
export namespace MyWonderfulClass {
export interface MyWonderfulClassType {}
}
export default MyWonderfulClass;
```
```typescript
// file: script.ts
import MyWonderfulClass from "./MyWonderfulClass.class";
const inst = new MyWonderfulClass();
const obj: MyWonderfulClass.MyWonderfulClassType = {};
```
VS Code version: Code 1.102.0 (cb0c47c0cfaad0757385834bd89d410c78a856c0, 2025-07-09T22:10:34.600Z)
OS version: Windows_NT x64 10.0.26100
Modes:
Remote OS version: Linux x64 6.6.87.2-microsoft-standard-WSL2
System Info
|Item|Value|
|---|---|
|CPUs|13th Gen Intel(R) Core(TM) i9-13900K (32 x 2995)|
|GPU Status|2d_canvas: enabled
canvas_oop_rasterization: enabled_on
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
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off|
|Load (avg)|undefined|
|Memory (System)|63.72GB (42.33GB free)|
|Process Argv|--crash-reporter-id cbb68604-7b21-4289-9c14-7e1fc2a74fab|
|Screen Reader|no|
|VM|0%|
|Item|Value|
|---|---|
|Remote|WSL: Ubuntu|
|OS|Linux x64 6.6.87.2-microsoft-standard-WSL2|
|CPUs|13th Gen Intel(R) Core(TM) i9-13900K (32 x 0)|
|Memory (System)|31.20GB (29.24GB free)|
|VM|0%|
Extensions (35)
Extension|Author (truncated)|Version
---|---|---
vscode-tailwindcss|bra|0.14.25
vscode-modelines|chr|2.0.6
vscode-css-modules|cli|0.5.4
vscode-eslint|dba|3.0.10
es7-react-js-snippets|dsz|4.4.3
gitlens|eam|17.3.0
vscode-html-css|ecm|2.0.13
vscode-great-icons|emm|2.1.119
php-intellisense|fel|2.3.14
vscode-firefox-debug|fir|2.15.0
auto-rename-tag|for|0.1.10
vscode-github-actions|git|0.27.2
go|gol|0.48.0
todo-tree|Gru|0.0.226
beautify|Hoo|1.5.0
rest-client|hum|0.25.1
git-graph|mhu|1.30.0
vscode-containers|ms-|2.0.3
vscode-docker|ms-|2.0.0
vscode-edge-devtools|ms-|2.1.9
remote-containers|ms-|0.422.0
remote-ssh|ms-|0.120.0
remote-ssh-edit|ms-|0.87.0
remote-wsl|ms-|0.99.0
vscode-remote-extensionpack|ms-|0.26.0
cpptools|ms-|1.26.3
powershell|ms-|2025.2.0
remote-explorer|ms-|0.5.0
remote-server|ms-|1.5.2
prisma|Pri|6.11.1
perl|ric|2.6.2
vscode-icons|vsc|12.13.0
vscode-nginx|wil|0.7.2
php-pack|xde|1.0.3
html-css-class-completion|Zig|1.20.0
A/B Experiments
```
vsliv368:30146709
vspor879:30202332
vspor708:30202333
vspor363:30204092
vscod805:30301674
binariesv615:30325510
vsaa593cf:30376535
py29gd2263:31024239
vscaat:30438848
c4g48928:30535728
azure-dev_surveyone:30548225
vscrp:30673768
962ge761:30959799
pythongtdpath:30769146
welcomedialog:30910333
pythonnoceb:30805159
asynctok:30898717
pythonmypyd1:30879173
h48ei257:31000450
pythontbext0:30879054
accentitlementsc:30995553
dsvsc016:30899300
dsvsc017:30899301
dsvsc018:30899302
cppperfnew:31000557
dsvsc020:30976470
pythonait:31006305
dsvsc021:30996838
945dj816:31013170
a69g1124:31058053
dvdeprecation:31068756
dwnewjupytercf:31046870
newcmakeconfigv2:31071590
impr_priority:31102340
nativerepl2:31139839
refactort:31108082
pythonrstrctxt:31112756
flightc:31134773
wkspc-onlycs-t:31132770
wkspc-ranged-c:31125598
fje88620:31121564
notype1:31143045
cc771715:31140165
```
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
MyWonderfulClass.class.ts と script.ts を使用して、報告にある 3 つの宣言マージ手順に従い、問題を再現します。次に、このケースの Rename Symbol のエントリーポイントを追跡し、名前変更後もクラスと namespace の両方への参照が有効なままであることを確認します。インポートされたインスタンスと MyWonderfulClass.MyWonderfulClassType への参照が引き続き解決されれば、issue は完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- typescript
- 領域
- tooling
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 45/100