microsoft / microsoft/TypeScript
Imperative type definition
まだ誰も着手していません。
- 主要言語
- Go
- スター
- 111k
- フォーク
- 14.3k
- 平均マージ
- 2日 4時間
- マージ済み PR(30日)
- 132
説明
🔍 Search Terms
imperative typescript interface
✅ Viability Checklist
- 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, new syntax sugar for JS, etc.)
- This isn't a request to add a new utility type: https://github.com/microsoft/TypeScript/wiki/No-New-Utility-Types
- This feature would agree with the rest of our Design Goals: https://github.com/Microsoft/TypeScript/wiki/TypeScript-Design-Goals
⭐ Suggestion
I work on a library that requires to use lots of 3rd party generic types, multiple mappings and more or less complex typing, and I've got to repeat one complex type multiple times or create another generic that is going to contain a lot of parameters and will complicate the code that's already complicated.
(these types have bugs, they just an illustration)
📃 Motivating Example
I imagine it as an "type function" that has function body that returns any valid type.
imperative type Foo<T> {
type X = Bar<T>;
type Y = Baz<T>;
return { x: X, y: Y };
}
type Quix = Foo<string>;
// Quix { x: Bar<string>, y: Baz<string> }
// ... vs
interface Foo<T> {
x: Bar<T>;
y: Baz<T>;
}
💻 Use Cases
- Imperative style
- Shorter syntax for complex types
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
実装ファイル、エントリーポイント、またはテストは特定されていません。まず、提案された構文と動機付けとなる例を TypeScript の設計目標に照らして検討し、次に型チェッカーのアーキテクチャを調査して、そのような型レベルの機能をどこに組み込めるかを判断してください。合意された設計と、それに対応する実装およびテストが揃えば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- typescript
- 領域
- compilers
- issue の種類
- 機能追加
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 活発さ
- 停滞
- 明瞭さ
- 説明が足りない
- 初心者へのやさしさ
- 25/100