microsoft / microsoft/TypeScript
A way to enforce `composite`'s rules without using `incremental`
还没有人认领这个 Issue。
- 主要语言
- Go
- 星标
- 111k
- 派生
- 14.3k
- 平均合并
- 2 天 4 小时
- 30 天内合并 PR
- 132
描述
### 🔍 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
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先追踪 composite 和 incremental 编译器选项的验证方式,以及 composite 规则的强制执行位置。将该行为与 isolatedDeclarations 进行比较,然后确定在不启用 incremental 的情况下强制执行 composite 规则所需的选项语义。 proposed flag 能够在 CI 中工作,且不会引入 issue 中所述的缓存问题,即视为完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- typescript
- 领域
- build-system, compilers
- Issue 类型
- 功能
- 难度
- 5/5
- 预计耗时
- 一周以上
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100