microsoft / microsoft/TypeScript
Missing computed properties in declaration emit
まだ誰も着手していません。
- 主要言語
- Go
- スター
- 111k
- フォーク
- 14.3k
- 平均マージ
- 2日 4時間
- マージ済み PR(30日)
- 132
説明
With #60052, we now emit qualified names rather than generate an index signature for computed names in classes; however, this now puts us in an awkward place where regardless of errors, declaration emit diverges on isolatedDeclarations.
Playground Links:
- 5.7, without
isolatedDeclarations - Nightly, without
isolatedDeclarations - Nightly, with
isolatedDeclarations
export const greeting: unique symbol = Symbol();
export const count: unique symbol = Symbol();
export class MyClass1 {
[greeting]: string = "world";
[count]: number = 42;
}
export enum PropertyNames {
greeting = "greeting",
count = "count",
}
export class MyClass2 {
[PropertyNames.greeting]: string = "world";
[PropertyNames.count]: number = 42;
}
export let prop!: string;
export class MyClass3 {
[prop]: () => void = () => {}
}
Compared to --isolatedDeclarations false The declaration emit lacks expected contents in MyClass1 and MyClass2:
export declare const greeting: unique symbol;
export declare const count: unique symbol;
export declare class MyClass1 {
- [greeting]: string;
- [count]: number;
}
export declare enum PropertyNames {
greeting = "greeting",
count = "count"
}
export declare class MyClass2 {
- [PropertyNames.greeting]: string;
- [PropertyNames.count]: number;
}
export declare let prop: string;
export declare class MyClass3 {
[prop]: () => void;
}
It is surprising that prop is emitted regardless of --isolatedDeclarations, but not the other contents.
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
Playground のリンクで示されている TypeScript の declaration emit の動作から始め、MyClass1、MyClass2、MyClass3 について --isolatedDeclarations を付けた場合と付けない場合の出力を比較します。computed property の処理を追跡し、現在の prop の動作を維持しながら、declaration emit が期待される computed property を保持するようにします。出力された declaration の差分を例と照合して確認します。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- typescript
- 領域
- compilers
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100