microsoft / microsoft/TypeScript
Files outside rootDir emit files adjacent to themselves if they are imported by an included file
まだ誰も着手していません。
- 主要言語
- Go
- スター
- 111k
- フォーク
- 14.4k
- 平均マージ
- 1日 19時間
- マージ済み PR(30日)
- 117
説明
Bug Report
The documentation for rootDir states that
Note that TypeScript will never write an output file to a directory outside of outDir, and will never skip emitting a file. For this reason, rootDir also enforces that all files which need to be emitted are underneath the rootDir path.
If any included file imports a ts file outside of rootDir, a declaration file is generated for that imported file and emitted adjacent to it. noEmitOnError needs to be either omitted or set to false, or the -b flag needs to be specified for this to occur.
🔎 Search Terms
noEmitOnError, unwanted declaration files, emits outside outDir, emits outside declarationDir
🕗 Version & Regression Information
On all versions matching ^4.2.4 and on the current nightly, nonexhaustive, haven't checked others
- This is the behavior in every version I tried, and I reviewed the FAQ for entries about tsconfig.json behaviour and commandline behaviour
⏯ Playground Link
https://github.com/gtm-nayan/ts-no-emit-wat/
Sorry, couldn't figure out multiple files in the playground or the workbench.
💻 Code
🙁 Actual behavior
Declaration files emitted outside of output directory.
🙂 Expected behavior
No files should be emitted outside of the specified output directory.
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず、リンク先のリポジトリで動作を再現します。rootDir の外部にあり、インクルードされたファイルからインポートされるファイルと、それによって生じる宣言出力に注目してください。次に、TypeScript コンパイラーによる rootDir、outDir、declarationDir、noEmitOnError の処理を追跡します。完了の条件は、設定された出力ディレクトリの外部に宣言ファイルが出力されないことです。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- typescript
- 領域
- compilers
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100