Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TypeScript update with Angular update from 16 to 17

I'm trying to upgrade Angular from 16 to 17. The upgrade guide says:

Make sure that you are using a supported version of TypeScript before you upgrade your application. Angular v17 supports TypeScript version 5.2 or later.

However, Angular 16 requires TypeScript >=4.9.3 <5.2 and if I run npm install -D [email protected] trying to install TypeScript 5.2 or later I get the error:

npm warn Could not resolve dependency:
npm warn peer typescript@">=4.9.3 <5.2" from @angular-devkit/[email protected]

Therefore, TypeScript upgrade fails because Angular 16 doesn't support it. If I stay in my current TypeScript version and run ng update @angular/core@17 @angular/cli@17 I get the following error:

Package "@angular-devkit/build-angular" has an incompatible peer dependency to "typescript" (requires ">=4.9.3 <5.2", would install "5.4.5").
✖ Migration failed: Incompatible peer dependencies found.

How do I get out of this situation?

like image 920
André Avatar asked Mar 11 '26 09:03

André


1 Answers

The problem might be that you are trying to perform the update with the latest Angular CLI version. Try to use v17 instead:

npx @angular/cli@17 update @angular/core@17 @angular/cli@17
like image 188
JSON Derulo Avatar answered Mar 14 '26 00:03

JSON Derulo



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!