Angular-cli: ERROR in The Angular Compiler requires TypeScript >=3.6.4 and <3.8.0 but 3.8.3 was found instead.

Created on 2 Mar 2020  路  5Comments  路  Source: angular/angular-cli

Description

I just upgraded to Angular 9 using ng update --all --force -C. No other options worked.

Now when I run ng serve, I get an error, ERROR in The Angular Compiler requires TypeScript >=3.6.4 and <3.8.0 but 3.8.3 was found instead.

Why did Angular update me to Typescript 3.8.3 if it's not supported?

Most helpful comment

npm i typescript@">=3.6.4 <3.8.0"

All 5 comments

@bryanrideshark You can manually update the typescript version (say, to 3.7.5) after "ng update".

In general, I run into this type of issues with virtually every angular version upgrade. This question is really for the Angular Team, but is there a reason why the maximum typescript version should be set for each Angular release? For example, in this particular case, is there a reason why we should presume that Angular 9 will not work with future versions of typescript (or, even with 3.8.x), say, instead of following the semantic versioning convention?

TypeScript does not strictly follow semantic versioning. Breaking changes are present in minor releases. Since the Angular compiler leverages TypeScript, each minor version needs to be validated before it can be officially supported.

The combination of the --all and --force flags are why TypeScript 3.8 was installed. If using just the -all flag, the following will be reported:

Package "@angular-devkit/build-angular" has an incompatible peer dependency to "typescript" (requires ">=3.6 < 3.8", would install "3.8.3")
Package "@angular/compiler-cli" has an incompatible peer dependency to "typescript" (requires ">=3.6 <3.8", would install "3.8.3")

The --all flag will attempt to update every package mentioned in the workspace's package.json to the latest version.

For information regarding recommended update procedures, please see https://update.angular.io/#8.0:9.0

I found an older TypeScript GitHub issue that supports what @clydin is stating. Sigh.

https://github.com/microsoft/TypeScript/issues/14116

npm i typescript@">=3.6.4 <3.8.0"

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

_This action has been performed automatically by a bot._

Was this page helpful?
0 / 5 - 0 ratings

Related issues

brtnshrdr picture brtnshrdr  路  3Comments

rajjejosefsson picture rajjejosefsson  路  3Comments

JanStureNielsen picture JanStureNielsen  路  3Comments

hareeshav picture hareeshav  路  3Comments

ericel picture ericel  路  3Comments