microsoft / microsoft/TypeScript
Type Selection Queries
まだ誰も着手していません。
- 主要言語
- Go
- スター
- 111k
- フォーク
- 14.4k
- 平均マージ
- 1日 19時間
- マージ済み PR(30日)
- 117
説明
This might be a bit of a crazy idea, but here goes: to enable loose coupling between components we sometimes write Pick<Type, 'a' | 'b' | 'c'>
It would be nice if we could create a type query to select properties with a similar syntax to GraphQL:
e.g:
prop: AType[{a, b, c: { d }]
This would be equivalent to
prop: Pick<AType, 'a' | 'b'> & {c: Pick<AType['c'], 'd'>}
How often would you do that in "the real world" ? definitely more often if you could
How often should you do that? unclear ?
Some real-world code:
const testFetch = jest.fn()
class TestOptions extends GraphQlClient.Options {
public fetch = testFetch
}
const response: Pick<Response, 'ok' | 'json'> = {
ok: true,
async json() {
return { data: { auth: { token: testToken } } }
}
}
testFetch.mockResolvedValue(response)
Pick<Response, 'ok' | 'json'> could be Response[{ok, json}]
edit: that's not a great example use case, cause you could just as well do Partial<Response>
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず、TypeScript における既存の Pick と indexed-access type の挙動を調査し、次に提案されているネストされた選択構文を GraphQL 形式のクエリと比較します。issue の例を確認し、この機能に明確なユースケースと型システムの設計があるかどうかを判断します。完了とするには、単なる変換例ではなく、合意された構文、セマンティクス、実装計画が必要です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- typescript
- 領域
- compilers
- issue の種類
- 機能追加
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 活発さ
- 停滞
- 明瞭さ
- 説明が足りない
- 初心者へのやさしさ
- 25/100