microsoft / microsoft/TypeScript
abstract class prototype type has abstract methods even though they are not on the prototype
まだ誰も着手していません。
- 主要言語
- Go
- スター
- 111k
- フォーク
- 14.4k
- 平均マージ
- 1日 19時間
- マージ済み PR(30日)
- 117
説明
Bug Report
🔎 Search Terms
abstract, prototype, type
🕗 Version & Regression Information
All versions I tried
⏯ Playground Link
Playground link with relevant code
💻 Code
abstract class AnAbstract {
public abstract abstractMethod(): void;
public nonAbstractMethod(): void {
// do something
}
}
// no type error - undefined
console.log(AnAbstract.prototype.abstractMethod);
// no type error - false
console.log(AnAbstract.prototype.hasOwnProperty('abstractMethod'));
// defined
console.log(AnAbstract.prototype.nonAbstractMethod);
// true
console.log(AnAbstract.prototype.hasOwnProperty('nonAbstractMethod'));
🙁 Actual behavior
Abstract class prototype has abstract methods in the type
🙂 Expected behavior
Abstract class prototype to have only concrete methods in the type
I have a function that manually define methods based on what's in the prototype, unfortunately when I use an abstract class the type doesn't reflect reality.
If that type cannot change it would be great to be able to do something like:
type NoAbstract<T> = {
-abstract [key in keyof T]: T[key];
};
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
リンクされた TypeScript Playground の例から始め、宣言された抽象メソッドと実行時のプロトタイプの挙動を比較します。抽象クラスのプロトタイプの型がどのように形成されるかを追跡し、具体メソッドは引き続き利用可能である一方、抽象メソッドは利用できないことを確認します。報告された例が実行時の実態と一貫して型チェックされ、関連する回帰テストのカバレッジが通過すれば、issue は完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- javascript, typescript
- 領域
- compilers
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100