microsoft / microsoft/TypeScript

A way to enforce `composite`'s rules without using `incremental`

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

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

In Discussion 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

composite
incremental
composite without incremental
turborepo caching

### ✅ Viability Checklist

- [x] This wouldn't be a breaking change in existing TypeScript/JavaScript code
- [x] This wouldn't change the runtime behavior of existing JavaScript code
- [x] This could be implemented without emitting different JS based on the types of the expressions
- [x] This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, new syntax sugar for JS, etc.)
- [x] This isn't a request to add a new utility type: https://github.com/microsoft/TypeScript/wiki/No-New-Utility-Types
- [x] This feature would agree with the rest of our Design Goals: https://github.com/Microsoft/TypeScript/wiki/TypeScript-Design-Goals

### ⭐ Suggestion

Sometimes when debugging performance issues with badly specified `includes`s globs, the `composite` flag can be really helpful because it will enumerate all the code that you are referencing and need to put in the `include`s, and then you can add paths incrementally instead of just having something like `**/*.ts`.

There are some reasons why I'm a little bit uneasy about enabling `composite` *and* `incremental`, mainly that we use Turborepo to cache package builds, and I'm a little bit worried about having two different caching mechanisms.

You can see this issue:

- https://github.com/woocommerce/woocommerce/pull/37374

To get an idea of why it can be a problem.

Similar to how `--isolatedDeclarations` enforces certain rules without actually affecting build output, it'd be nice if there was a way to use `composite`'s rules without being forced to set `incremental` too.

### 📃 Motivating Example

Maybe something like:

`--enforceCompositeRules`

### 💻 Use Cases

Right now there's no real workaround, `composite` and `incremental` have to go together. You can have `incremental` _without_ `composite` but you run the risk of having caching bugs.

In CI one could probably just run a typecheck with the flags turned on manually I suppose, and not use it in other contexts

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 truy vết cách các tùy chọn của trình biên dịch composite và incremental được xác thực, cũng như nơi các quy tắc composite được thực thi. So sánh hành vi đó với isolatedDeclarations, sau đó xác định ngữ nghĩa tùy chọn cần thiết để thực thi các quy tắc composite mà không bật incremental. Công việc được xem là hoàn tất khi flag được đề xuất hoạt động trong CI và không đưa vào các vấn đề về caching được mô tả trong issue.

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
build-system, compilers
Loại issue
Tính năng
Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
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.