microsoft / microsoft/TypeScript

Files outside rootDir emit files adjacent to themselves if they are imported by an included file

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

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

Docs
主要言語
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.

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

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

はじめの一歩

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

調査の方向性

まず、リンク先のリポジトリで動作を再現します。rootDir の外部にあり、インクルードされたファイルからインポートされるファイルと、それによって生じる宣言出力に注目してください。次に、TypeScript コンパイラーによる rootDir、outDir、declarationDir、noEmitOnError の処理を追跡します。完了の条件は、設定された出力ディレクトリの外部に宣言ファイルが出力されないことです。

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

評価

技術スタック
typescript
領域
compilers
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

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

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