microsoft / microsoft/TypeScript
Isolated declarations does not handle object getters and setters with different types
オープン
まだ誰も着手していません。
Domain: Declaration Emit
Domain: flag: isolatedDeclarations
Experience Enhancement
- 主要言語
- Go
- スター
- 111k
- フォーク
- 14.4k
- 平均マージ
- 1日 19時間
- マージ済み PR(30日)
- 117
説明
🔎 Search Terms
- isolated declarations
- object getter
- object setter
🕗 Version & Regression Information
5.5.0-dev.20240514
⏯ Playground Link
💻 Code
export const a = {
get b(): string {
return ""
},
set b(val: string) {
}
};
type StringAlias = string;
export const c = {
get d(): StringAlias {
return ""
},
set d(val: string) {
}
};
export const e = {
get f(): string {
return ""
},
set f(val: number) {
}
};
🙁 Actual behavior
TypeScript emits:
export declare const a: {
b: string;
};
export declare const c: {
d: string;
};
export declare const e: {
get f(): string;
set f(val: number);
};
This is behaviour is not possible to reproduce for isolated declarations emitters, because it requires type comparisons for the types of the setter and getter.
🙂 Expected behavior
One of:
Emit based on syntax, do not collapse a getter/setter pair with the same type to a property
export declare const a: {
get b(): string;
set b(val: string);
};
export declare const c: {
get d(): StringAlias;
set d(val: string);
};
export declare const e: {
get f(): string;
set f(val: number);
};
OR
Error on both c.d and e.f because return type of getter and setter do not match
Additional information about the issue
cc @dragomirtitian
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
提供されたPlaygroundの例をisolatedDeclarationsで開始し、a、c、eに対して出力される宣言を比較します。Issueではリポジトリのファイルやテストが指定されていないため、まず構文ベースのgetter/setterの出力と型が一致しない場合のエラーのどちらを採用するかを決め、その後、選択した動作を一貫して検証する必要があります。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- typescript
- 領域
- compilers
- issue の種類
- バグ
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 25/100