microsoft / microsoft/TypeScript
Dead code typecheck elimination
まだ誰も着手していません。
- 主要言語
- Go
- スター
- 111k
- フォーク
- 14.4k
- 平均マージ
- 1日 19時間
- マージ済み PR(30日)
- 117
説明
Suggestion
🔍 Search Terms
dead code typecheck elimination
✅ Viability Checklist
My suggestion meets these guidelines:
- 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 feature would agree with the rest of TypeScript's Design Goals.
⭐ Suggestion
When the include field is set, TypeScript will only typecheck the given files ... and their dependencies, and transitive dependencies. It can grow unwieldy pretty fast.
It'd be good for performances to if TS could have a skipDeadCodeTypechecks call that would cause it to skip the typecheck of all statements that aren't part of the execution tree of the files listed inside include.
📃 Motivating Example
If you were announcing this feature in a blog post, what's a short explanation that shows
a developer why this feature improves the language?
In the new TypeScript update, we're excited to introduce the
skipDeadCodeTypechecksfeature. This was born out of the need for a more efficient type-checking process. Previously, when setting theincludefield, TypeScript would typecheck all given files, their dependencies, and their transitive dependencies. This could quickly get out of hand, resulting in a typechecking process that would run over many more files than the author intended!The
skipDeadCodeTypechecksfeature aims to solve this issue. Instead of typechecking every single file and their dependencies, this new feature will only typecheck the code that is actually executed when the files listed inside include are run. This means that TypeScript will skip typechecking for code that is not part of the execution tree for these files, hence "dead" code.
💻 Use Cases
We have a very large repository we're trying to split into reference workspaces. But until we get there, we'd like to selectively pick the folders to typecheck. We do that with the include field, but it's still very slow (30s to typecheck what's supposed to be a relatively small part of the application).
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
この issue では、ファイル、テスト、エントリーポイントが指定されていません。まず、include ファイルとその推移的な依存関係がどのように型チェックされるかを把握し、次に実行ツリーに含まれるものを定義し、デッドコードをスキップしても期待される診断結果が維持される方法を定義してください。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- typescript
- 領域
- compilers
- issue の種類
- 機能追加
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 活発さ
- 停滞
- 明瞭さ
- 説明が足りない
- 初心者へのやさしさ
- 25/100