microsoft / microsoft/TypeScript

Idea: Can declaration emit synthesize type aliases?

オープン
#44,045 コメント 5 件 リアクション 1 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

Domain: Performance Experimentation Needed Suggestion
主要言語
Go
スター
111k
フォーク
14.3k
平均マージ
1日 19時間
マージ済み PR(30日)
117

説明

Object types can be very large and in (e.g.) a react project that makes heavy use of type inference, it's not uncommon to have to refer to a type that is either not imported or is simply anonymous (e.g. a props type). When these appear in multiple places in a declaration file, they tend to expand it considerably. Perhaps we could just synthesize type aliases for them?

  • We'd have to be careful not to change the exported API shape
  • We could use a heuristic to skip the work for small types (e.g. < 20 characters)
  • Even if we didn't wait until the second use of a type to decide to extract it, we'd be adding ~4 tokens per type (type id = and id at the use site)

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

この issue では、繰り返し現れる大きな匿名オブジェクト型に対して、宣言の出力時に型エイリアスを合成することを提案しています。ファイル、テスト、エントリーポイントは指定されていないため、まず宣言出力の実装を把握し、提示されたサイズヒューリスティックを評価してください。完了条件は、エクスポートされる API の形状を変更せずに、宣言ファイルの展開を削減することです。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
typescript
領域
compilers
issue の種類
機能追加
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
30/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。