microsoft / microsoft/TypeScript
Provide a `this` type for `get`/`set` methods in `Reflect.defineProperty` options
オープン
まだ誰も着手していません。
Experience Enhancement
Suggestion
- 主要言語
- Go
- スター
- 111k
- フォーク
- 14.3k
- 平均マージ
- 2日 4時間
- マージ済み PR(30日)
- 132
説明
Code
var A: {a?: number, b: number} = {b:2}
Reflect.defineProperty(A, 'a', {
// set(this: any, value: any) { // to fix
set(value: any) {
console.log(this.b); // Property 'b' does not exist on type 'PropertyDescriptor'.
},
enumerable: true,
configurable: true
});
A.a = 1;
// expect the context of setter is A
Expected behavior:
expect the context of the setter is A
Actual behavior:
Property 'b' does not exist on type 'PropertyDescriptor'.
Playground Link:
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
リンク先の TypeScript Playground の例から始め、setter の推論された this と期待される receiver 型を比較します。Reflect.defineProperty のオプションと PropertyDescriptor の型定義を追跡し、その後、適切な既存のテスト領域にこの例のカバレッジを追加します。setter コンテキストが報告されたエラーなしで対象オブジェクトとして型付けされれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- typescript
- 領域
- compilers
- issue の種類
- 機能追加
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 25/100