microsoft / microsoft/TypeScript
Provide way to configure default compiler options for TS Server Inferred Project
まだ誰も着手していません。
- 主要言語
- Go
- スター
- 111k
- フォーク
- 14.3k
- 平均マージ
- 2日 4時間
- マージ済み PR(30日)
- 132
説明
Search Terms
Inferred Project
TS Server
Suggestion
Add an option to configure the default compilerOptions for inferred projects outside of the host.
Related to: https://docs.google.com/document/d/1eB6cGCG_2ircfS5GzpDC9dBgikeYYcMxghVH5sDESHw/edit#heading=h.telvo0tzo7t0 and https://github.com/microsoft/TypeScript/issues/39632
Checklist
Use Cases
Currently, there is no way to configure the default compilerOptions for inferred projects outside of the server host. Being able to configure should options would be give a better DX when not using the default compiler options such as experimentalDecorators, strictNullChecks etc... together with stricter file inclusions, ie favoring explicitly listing the entry-point files using files instead of include with globbing.
Previously when not using TypeScript solution style tsconfig this could be achieved by adding a tsconfig.json in the root of the project which will include all files and set these options example.
{
"compilerOptions": {
"experimentalDecorators": true,
"strictNullChecks": true,
...
}
}
This trickery cannot be used when using a solution style tsconfig, because the root tsconfig will not contain any files due to files: [] setting.
Examples
Ideally, compiler options for inferred projects are configured in a TypeScript configuration file. When using solution style tsconfig, such configuration can be set here.
{
"files": [],
"compilerOptions": {
"experimentalDecorators": true,
"strictNullChecks": true,
...
},
"references": [
{
"path": "./tsconfig.app.json"
},
{
"path": "./tsconfig.spec.json"
}
]
}
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, etc.)
- This feature would agree with the rest of TypeScript's Design Goals.
//cc @kyliau
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
TS Server の inferred projects の動作と、リンクされている issue 39632 から始め、その後、files: [] を持つ solution-style の tsconfig ファイルがどのように処理されるかを確認します。experimentalDecorators や strictNullChecks などの compilerOptions のデフォルト値に必要な設定の場所と優先順位を特定します。既存のプロジェクトの動作を変更せずに inferred projects がこれらのデフォルト値を受け取れるようになれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- typescript
- 領域
- tooling
- issue の種類
- 機能追加
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100