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?
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).
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.
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/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With