Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Update Typescript in Angular2 project

I have an Angular2 project using Typescript, in Visual Studio. I want to update Typescript from 1.8 to 2.0.x. In my system I have updated typescript and tsc -v logs Version 2.0.10 The package.json, among others, contains

"devDependencies": {
    ....
    "typescript": "^1.8.10",
    "typings": "^1.3.1",
    ...
}

In order to update typescript, is it enough to change the version to "typescript": "^2.0.10" in the package.json? Also, what is the relation of typescript and typings version, when it comes to update?

like image 525
koninos Avatar asked Dec 01 '16 09:12

koninos


People also ask

How do I update my TypeScript version?

You can use npm to install TypeScript globally, this means that you can use the tsc command anywhere in your terminal. To do this, run npm install -g typescript . This will install the latest version (currently 4.8).

How do I upgrade TypeScript in Angular 6?

Or you can remove the orginal version, run yarn global remove typescript , and then execute yarn global add typescript , by default it will also install the latest version of typescript.


2 Answers

For Exact version

For latest release

  • npm install typescript@latest --save-dev
like image 59
Pardeep Jain Avatar answered Oct 20 '22 20:10

Pardeep Jain


Updating the typescript version in your package.json and running npm install will be enough to upgrade the version you are using for your project.

Typescript 2.x has introduced a new way to manage types, using the @types/... qualifier npm packages - you can still use the typings you have been using before however - but you might wish to update that to the latest version which from npm at the time of writing this answer is 2.0.0

If you are interested, theres more info and a discussion about the new @types here https://blogs.msdn.microsoft.com/typescript/2016/06/15/the-future-of-declaration-files/

like image 31
peppermcknight Avatar answered Oct 20 '22 21:10

peppermcknight