Multiple ways to know typescript version in Angular 12/13

This tutorial covers how to find a typescript version in an application developed with Angular Framework.

Angular is based on typescript. Typescript is a popular programming language from Microsoft. It is an extended javascript with typing and oops support.

Angular uses typescript as the language for writing components.

How to find typescript version in Angular 15 project

Angular 15 is the latest version released in November 2021. It is very easy to know the typescript version in the Angular 15 project.

First change to the application directory and run the ng —version command.

Here is a command to get a typescript version in Angular 15

A:\work\angular-app>ng --version

     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/


Angular CLI: 13.0.3
Node: 14.17.0
Package Manager: npm 7.11.1
OS: win32 x64

Angular: 13.0.2
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1300.3
@angular-devkit/build-angular   13.0.3
@angular-devkit/core            13.0.3
@angular-devkit/schematics      13.0.3
@angular/cli                    13.0.3
@schematics/angular             13.0.3
rxjs                            7.4.0
typescript                      4.4.4

Typescript 4.4.4 is the latest version used in the Angular 15 application.

How to find typescript version in Angular 12 project

As a developer we need to know the typescript versions, if you install an incompatible typescript version in an angular application, you will get the following error.

Error: The Angular Compiler requires TypeScript >=4.0.1 and 4.1.7 but 4.2.0 was found instead.

You can also check other post fixing Angular Compiler requires TypeScript

There are many ways we can find a typescript version in the Angular app.

  • using package.json

  • tsc command

  • ng version command

    using package.json:

First, In the project, the package.json file contains typescript dependencies information. package.json

{
  "typescript": "^4.2.0"
}

tsc command:

if typescript is installed into the application, tsc is the command being used to know the typescript version.

 B:\angular-example>tsc --version
Version 4.2.4

ng version command The second way, using the ng command, you can get angular and typescript versions installed into the angular application.

you can use one of the below commands.

ng -v
ng --version
ng version

Here is a command output

B:\angular-example>ng --version

     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/


Angular CLI: 12.0.3
Node: 14.17.0
Package Manager: npm 7.11.1
OS: win32 x64

Angular: 12.0.3
... animations, cli, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1200.3
@angular-devkit/build-angular   12.0.3
@angular-devkit/core            12.0.3
@angular-devkit/schematics      12.0.3
@schematics/angular             12.0.3
rxjs                            6.6.7
typescript                      4.2.4

This command gives typescript versions and angular dependencies versions.

Angular TypeScript version compatibility list

The below table answers the following questions

  • What is the typescript version for the Angular 15 version
  • which typescript version was used in the Angular 13 version
ParameterDescription
Angular 15TypeScript 4.9.3
Angular 14TypeScript 4.6.4
Angular 13TypeScript 4.4.4
Angular 12TypeScript 4.2.0
Angular 11TypeScript 4.0.3
Angular 10TypeScript 3.7
Angular 9TypeScript 3.7
Angular 8TypeScript 3.4
Angular 7Typescript 3.1
Angular 6Typescript 3.0
Angular 5Typescript 2.7
Angular 4TypeScript 2.4
Angular 2Typescript 2.0

How to find a typescript version in Visual Studio Code?

It is very easy and simple to find a typescript version in VSCode.

The following is a sequence of step by steps.

  • First, Go to the Terminal menu item in VSCode

  • Select New Terminal and open terminal window (or) you can use short cut command Ctrl + Shift +`

  • type the following command

    b:\tsc -v
    Version 4.1.3

How to update/downgrade typescript version in Angular application

It is easy to update to a new version or the latest version as well as downgrade the version to a lower version with the npm install command.

Here is a sequence of steps.

Open a terminal and go to the angular application directory.

if you want to install a specific version, Here is a command

npm install typescript@4.2.0 --save-dev

to install the latest versions,

npm install typescript@latest --save-dev

In this way, We can install typescript in Angular application with the specific or latest version.

This updates or an entry in package.json

How to uninstall typescript in Angular project

with npm uninstall, It will uninstall from the angular application

npm uninstall typescript

And, It removes the dependencies from package.json

{
  "devDependencies": {
    "gulp-purgecss": "4.2.0"
  }
}

Conclusion

We have learned how to find the typescript version being used in the Angular application, In this short tutorial, You learned multiple ways to know the typescript version in angular and visual studio code. It also includes Listing out angular -2,4,5,6,7,8,9,10,11 and 12 versions and their typescript supported versions.