microsoft / microsoft/TypeScript
A way to enforce `composite`'s rules without using `incremental`
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.3k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 132
Description
### 🔍 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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing how the composite and incremental compiler options are validated and where composite rules are enforced. Compare that behavior with isolatedDeclarations, then determine the option semantics needed to enforce composite rules without enabling incremental. Done means the proposed flag works in CI and does not introduce the caching concerns described in the issue.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- build-system, compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100