microsoft / microsoft/TypeScript

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

Đang mở
#52,889 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Docs
Ngôn ngữ chính
Go
Star
111k
Fork
14.4k
Merge trung bình
1 ngày 19 giờ
Pull request đã merge (30 ngày)
117

Mô tả

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.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu bằng cách tái hiện hành vi trong repository được liên kết, tập trung vào một tệp bên ngoài rootDir được một tệp được đưa vào import và phần phát sinh declaration emit. Sau đó, lần theo cách trình biên dịch TypeScript xử lý rootDir, outDir, declarationDir và noEmitOnError; công việc được xem là hoàn tất khi không có tệp khai báo nào được phát ra bên ngoài thư mục đầu ra đã cấu hình.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
typescript
Lĩnh vực
compilers
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.