microsoft / microsoft/TypeScript

Allow '--noEmit' to override 'emitDeclarationOnly' from config.

Đang mở
#32,380 6 bình luận 15 reaction 0 người được giao Xem trên GitHub

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

Awaiting More Feedback Suggestion
Ngôn ngữ chính
Go
Star
111k
Fork
14.3k
Merge trung bình
2 ngày 4 giờ
Pull request đã merge (30 ngày)
132

Mô tả

Search Terms

  • TS5053
  • emitDeclarationOnly

Suggestion

Using "emitDeclarationOnly": true in your tsconfig.json prevents you to do typechecking only runs as running tsc --noEmit will throw the following error.

error TS5053: Option 'emitDeclarationOnly' cannot be specified with option 'noEmit'.

And the CLI does not look like to have any flag to bypass the error (eg. something like --noEmitDeclarationOnly).

I don't see a reason why a noEmit cli flag would not take precedence over the emitDeclarationOnly from the tsconfig.

Use Cases

With a project with a tsconfig.json set with emitDeclarationOnly and using another compiler like babel to produce the built javascript code, you want to be able to both:

  • Compile declaration files (running tsc)
  • Perform typechecking as a test stage (eg. travis) (running tsc --noEmit). Especially since you do not use TypeScript to compile (so a build could pass with typings errors).

Examples

https://github.com/mgcrea/node-influx-syslog

Checklist

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.

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 từ phần xác thực tùy chọn trình biên dịch báo cáo TS5053 và theo dõi cách noEmit trên dòng lệnh được hợp nhất với emitDeclarationOnly trong tsconfig. Bổ sung phạm vi kiểm thử cho thứ tự ưu tiên được yêu cầu và xác minh cả các đường dẫn phát sinh khai báo lẫn kiểm tra kiểu noEmit; hoàn tất có nghĩa là tsc --noEmit chấp nhận cấu hình trong khi hành vi bình thường của tsc vẫn được giữ nguyên.

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
cli, compilers
Loại issue
Tính năng
Độ 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.