microsoft / microsoft/TypeScript
Files outside rootDir emit files adjacent to themselves if they are imported by an included file
还没有人认领这个 Issue。
- 主要语言
- Go
- 星标
- 111k
- 派生
- 14.4k
- 平均合并
- 1 天 19 小时
- 30 天内合并 PR
- 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 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先在链接的仓库中复现该行为,重点关注 rootDir 外部的一个文件,该文件由一个被包含的文件导入,并关注由此产生的声明输出。然后追踪 TypeScript 编译器对 rootDir、outDir、declarationDir 和 noEmitOnError 的处理;完成的标准是配置的输出目录之外不会输出任何声明文件。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- typescript
- 领域
- compilers
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100