To upgrade the typescript version of your Angular project to the latest stable version, use :
npm i typescript@latest --save-dev
You can verify the upgrade in your package.json file :
"devDependencies": {
// ...
"typescript": "^5.2.2" // typescript current installed version
}
Answer from PaulCrp on Stack OverflowTo upgrade the typescript version of your Angular project to the latest stable version, use :
npm i typescript@latest --save-dev
You can verify the upgrade in your package.json file :
"devDependencies": {
// ...
"typescript": "^5.2.2" // typescript current installed version
}
You can run the below code to upgrade the version of your current project
npm i typescript@next -D
Do I need to wait for the next release of Angular before I can update to the latest version of TypeScript or can I just go ahead and update the package.json to include the latest version?
Videos
For Exact version
- npm install [email protected] --save-dev
For latest release
- npm install typescript@latest --save-dev
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/
Try npm install -g typescript@latest. You can also use npm update instead of install, without the latest modifier.
Open command prompt (cmd.exe/git bash)
Recommended:
npm install -g typescript@latest
or
yarn global add typescript@latest // if you use yarn package manager
This will install the latest typescript version if not already installed, otherwise it will update the current installation to the latest version.
And then verify which version is installed:
tsc -v
If you have typescript already installed you could also use the following command to update to latest version, but as commentators have reported and I confirm it that the following command does not update to latest (as of now [ Feb 10 '17])!
npm update -g typescript@latest