microsoft / microsoft/TypeScript

skipLibChecks specificity

オープン
#63,397 コメント 4 件 リアクション 0 件 担当者 0 名 GitHub で見る

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

Needs Proposal Suggestion
主要言語
Go
スター
111k
フォーク
14.3k
平均マージ
2日 4時間
マージ済み PR(30日)
132

説明

🔍 Search Terms

skipLibCheck specific files

✅ Viability Checklist
⭐ Suggestion

Currently skipLibCheck is an all or nothing proposition. You either suppress all errors from declaration files or you get errors from all declaration files. This is not really an accurate reflection of how declaration files are usually used. Almost all projects use declaration files from a trusted source, like npm. Errors from these files are usually not relevant and can be safely suppressed. Many projects however also have declaration files they write by hand (usually for interop with js files, or for libraries that are not typed) - these generally should be type checked since they are actively authored as part of the project.

Ideally skipLibCheck would allow us to more granularly control which declaration files are checked and which are not. This allows us to reap the performance benefits of skipLibCheck while not sacrificing type checking on authored code.

Proposal

One possible solution would be to allow skipLibCheck to be a list of glob patterns for which type checking should be skipped. This would be a simple solution allowing users to decide what declaration files they want and don't want checked.

While this solution is probably the simplest one to implement, we should consider other ones.

📃 Motivating Example

We have a custom build tool that uses the compiler API to force some declaration files to skip checking by setting their hasDefaultLib flag and using skipDefaultLibCheck instead of skipLibCheck. While this solution worked well in the past this is not really a supported solution which we expect will break (6.0 already breaks our current implementation - we have found an alternate implementation, 7.0 will make any sort of custom solution much more difficult)

💻 Use Cases
  1. What do you want to use this for?
    Improve build performance of TypeScript projects.

  2. What shortcomings exist with current approaches?
    You can suppress errors from all declaration files or from none. There is no granular control over it.

  3. What workarounds are you using in the meantime?
    Use the compiler API to control which declaration files are checked.

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

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

はじめの一歩

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

調査の方向性

まず提案と、コンパイラーオプション skipLibCheck および skipDefaultLibCheck の現在の動作を確認します。issue ではファイルやテストが指定されていないため、glob パターンやその他の設計のどれを選ぶか決める前に、コンパイラーオプションの処理箇所と関連するテストカバレッジを特定してください。宣言ファイルのチェックを粒度細かく制御しつつ、記載されたパフォーマンス上の利点を維持できれば完了です。

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

評価

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

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

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