microsoft / microsoft/TypeScript
Type assertions using Exact, Subset, Superset
まだ誰も着手していません。
- 主要言語
- Go
- スター
- 111k
- フォーク
- 14.3k
- 平均マージ
- 1日 19時間
- マージ済み PR(30日)
- 117
説明
I have suffered several times with the limitations of casting like so:
res.json(<Foo>{foo:'bar'});
the above cast/assertion will work even if the anonymous object does not have all the fields in type Foo.
For example, this question I had: https://stackoverflow.com/questions/53328459/prevent-compilation-unless-all-fields-exist
This feature request is for something like this:
res.json(Exact<Foo>{foo:'bar'});
res.json(Subset<Foo>{foo:'bar'});
res.json(Superset<Foo>{foo:'bar'});
note this is similar to the existing construct Partial, as in Partial<T>, hopefully the above are self-explanatory. I am not sure if both Subset<> and Superset<> make sense, but one of them should.
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず、提案されている Exact、Subset、Superset 型アサーション構文を確認し、既存の Partial 構文と比較してください。必要なセマンティクスを定義し、Subset と Superset の両方が必要かどうかも含めてください。この issue ではファイル、テスト、エントリポイントが指定されていないため、完了には設計とその検証基準を確立する必要があります。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- typescript
- 領域
- compilers
- issue の種類
- 機能追加
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 25/100