How to upgrade typescript to any specific version or latest version from Command Prompt
If you want to upgrade or downgrade the Typescript version, then you can simply do that with the help of simple command.
Following is the command if you want to upgrade to the latest Typescript version. Open the Node.js Command Prompt and execute the below command:
npm install -g typescript
Following is the command if you want to upgrade / downgrade Typescript to any specific version (e.g. 3.9, 3.8, 3.7, 3.6, 3.5, 3.0 etc.), execute the below command using Node.js command prompt:
npm install -g firstname.lastname@example.org
In the above command, we have set the Typescript version to 3.3, after setting to Version 3.3, our typescript code stopped working because code was having features of Typescript version 3.4+, so again after upgrading to latest Typescript Version 3.9, our code started working again. You can upgrade it to latest using our "npm install -g typescript" command which will install the latest Typescript version.
Once you upgrade / downgrade Typescript version, you can confirm the current installed version by executing following command, the below command will provide you which Typescript Version your machine is currently using for executing typescript (.ts) files:
You can see, my machine was using 3.9.5 Typesript Version, so it displayed "Version 3.9.5" when I executed "tsc -v" command.