microsoft / microsoft/TypeScript
Enable type parameter lower-bound syntax
オープン
まだ誰も着手していません。
In Discussion
Suggestion
- 主要言語
- Go
- スター
- 111k
- フォーク
- 14.3k
- 平均マージ
- 2日 4時間
- マージ済み PR(30日)
- 132
説明
TypeScript Version: 2.1.1
Code
class Animal {}
class Cat extends Animal {}
class Kitten extends Cat{}
function foo<A super Kitten>(a: A) { /* */ }
Expected behavior:
The type parameter A has the type Kitten as lower-bound.
Actual behavior:
Compilation failure. The syntax is unsupported.
Discussion:
The upper-bound counterpart of the failed code works fine:
class Animal {}
class Cat extends Animal {}
class Kitten extends Cat{}
function foo<A extends Animal>(a: A) { /* */ }
People in issue #13337 have suggested to use
function foo <X extends Y, Y>(y: Y) { /* */ }
to lower-bound Y with X. But this does not cover the case where X is an actual type (instead of a type parameter).
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず、提案されている A super Kitten 構文と issue #13337 の議論を確認してください。ここでは実装ファイルやテストが特定されていないためです。必要な言語および型チェックの変更を判断し、下限型パラメーターがコンパイルされ、説明どおりに動作することを示すカバレッジを追加してください。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- typescript
- 領域
- compilers
- issue の種類
- 機能追加
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 活発さ
- 停滞
- 明瞭さ
- 明確に書かれている
- 初心者へのやさしさ
- 25/100