Skip to content
Latchkey

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).

ng build
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

  1. Read the exact ">=X and <Y" range from the error.
  2. Pin typescript in package.json to a version inside that window.
  3. Reinstall and commit the lockfile so CI uses the pinned version.
package.json
"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.

Terminal
ng update @angular/cli @angular/core

How 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.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →