How to Check Version in TypeScript

  1. Install TypeScript
  2. Check TypeScript Version Globally
  3. Check TypeScript Version Locally
How to Check Version in TypeScript

Versions are a very important concept for building software. Some dependencies work only with certain software versions; therefore, it is very important to know the exact version of the software.

TypeScript provides some ways to check the version of the build either globally or within the local dependencies. This tutorial will focus on checking the version of the installed build of TypeScript.

Install TypeScript

TypeScript can be installed globally or within your project’s dependencies, which may be a node-based project, a ReactJS project, or any JavaScript framework-based project. Install TypeScript globally on the system.

npm install -g typescript

The above command should be used in the terminal, provided that node and npm are installed. To install TypeScript locally among one of its dependencies, use the command below.

npm i typescript

Check TypeScript Version Globally

TypeScript may be installed globally on one’s system, and the version can be checked via the tsc command.

tsc -v

// or

tsc -version

The globally installed TypeScript version may differ from the locally installed TypeScript version.

Check TypeScript Version Locally

The exact version installed as a package can be found using the npm command.

npm ls typescript

Moreover, the locally installed TypeScript version can be found using the locally installed tsc binary.

./node_modules/bin/tsc -v

TypeScript has seen a lot of version changes over the years ranging from 1.0.0 to 4.0. Any version that says ^3.7.0 means that on a new install, the next update can update the version to a new version more than the minor version mentioned, which can be 3.7.1, 3.8.0, etc.

If the version is ~3.7.0, then the new versions on a fresh install can be 3.7.1, 3.7.2 but never 3.8.

Shuvayan Ghosh Dastidar avatar Shuvayan Ghosh Dastidar avatar

Shuvayan is a professional software developer with an avid interest in all kinds of technology and programming languages. He loves all kinds of problem solving and writing about his experiences.

LinkedIn Website

Related Article - TypeScript Version