Angular "The Angular Compiler requires TypeScript >=X and <Y" in CI
The Angular AOT compiler enforces a supported TypeScript range. If CI resolves a typescript version above or below that window, the build stops before compiling and prints the exact supported range.
What this error means
ng build fails with "The Angular Compiler requires TypeScript >=5.2.0 and <5.5.0 but 5.6.2 was found instead" (versions vary by Angular release).
error TS: The Angular Compiler requires TypeScript >=5.2.0 and <5.5.0 but 5.6.2 was found instead.Common causes
TypeScript was upgraded beyond the supported range
A caret range on typescript let CI resolve a newer TS major/minor than the current Angular version supports.
A transitive tool bumped TypeScript
A dev tool or a fresh install pulled in a TS version outside the Angular compiler window, so the compiler rejects it.
How to fix it
Pin TypeScript into the supported range
- Read the exact ">=X and <Y" range from the error.
- Pin typescript in package.json to a version inside that window.
- Reinstall and commit the lockfile so CI uses the pinned version.
"devDependencies": {
"typescript": "~5.4.0"
}Update Angular if you need a newer TypeScript
If you must move to a newer TS, upgrade Angular with ng update so the compiler supports it, rather than forcing an unsupported TS.
ng update @angular/cli @angular/coreHow to prevent it
- Pin typescript with a tilde range that stays inside the Angular window.
- Upgrade TypeScript only alongside a matching Angular upgrade.
- Use npm ci so the TS version is locked in CI.