EN
TypeScript - upgrade TypeScript compiler (global tsc upgrade)
9
points
In this short article, we would like to show how to upgrade TypeScript compiler.
Quick solution:
npm -g upgrade typescript
or upgrade to the latest major version:
npm -g install typescript
Hints:
install
run on installed package causes package upgrade to latest major version,- use
sudo
under Linux, e.g.
sudo npm -g upgrade typescript
sudo npm -g install typescript
- sometimes it may be necessary to restart or reload terminal to see the effect.
Detailed description
Open a terminal and do the following steps (in some cases as root, superuser or administrator):
- check TypeScript version with the command:
tsc -v
- run upgrade with the command:
npm -g upgrade typescript
sudo npm -g upgrade typescript
-g
means global installation mode
- restart or reload terminal to be sure the package version was reloaded,
- check TypeScript version again:
tsc -v
Note: the presented steps work on different platforms (Windows, Linux, etc.).
Practical example:
$ tsc -v
Version 3.3.3333
$ npm -g upgrade typescript
C:\Users\john\AppData\Roaming\npm\tsc -> C:\Users\john\AppData\Roaming\npm\node_modules\typescript\bin\tsc
C:\Users\john\AppData\Roaming\npm\tsserver -> C:\Users\john\AppData\Roaming\npm\node_modules\typescript\bin\tsserver
+ typescript@3.9.6
updated 1 package in 13.424s
$ tsc -v
Version 3.9.6