microsoft / microsoft/TypeScript
Support abstract mixin classes.
オープン
まだ誰も着手していません。
In Discussion
Suggestion
- 主要言語
- Go
- スター
- 111k
- フォーク
- 14.3k
- 平均マージ
- 2日 4時間
- マージ済み PR(30日)
- 132
説明
Search Terms
Related, but not completely the same: https://github.com/microsoft/TypeScript/issues/29653
Suggestion
Allow mixin classes to be abstract.
Use Cases
For example, by using a mixin, it might require the user to implement a method.
Examples
type Constructor<T = any, A extends any[] = any[]> = new (...a: A) => T
function AwesomeMixin<T extends Constructor>(Base: T = Object) {
return abstract class Awesome extends Base {
abstract someMethod(): number
}
}
gives:
Cannot find name 'abstract'.
and
Unreachable code detected
Checklist
My suggestion meets these guidelines:
- This wouldn't be a breaking change in existing TypeScript/JavaScript code
- This wouldn't change the runtime behavior of existing JavaScript code
- This could be implemented without emitting different JS based on the types of the expressions
- This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, etc.)
- This feature would agree with the rest of TypeScript's Design Goals.
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
抽象 mixin の例とリンク先の playground から始め、関連する issue #29653 と比較してください。コンパイラーが返される mixin クラス内の abstract を現在どのように解析し、チェックしているかを確認してください。完了とは、報告されたエラーなしでその例の型チェックが通り、出力される JavaScript は変更されないことを意味します。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- typescript
- 領域
- compilers
- issue の種類
- 機能追加
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100