انتقل إلى المحتوى الرئيسي

Installation TypeScript

To get started with TypeScript, you need to install its toolkit. You can install TypeScript through the NPM package manager.

Installing Node.js

To install via NPM, you need to have Node.js installed (if not already installed). For further actions, you need an installed package manager Chocolatey. Install NPM with it. To start the installation process, you need to run the command in Powershell:

choco install -y nodejs.install

Installing TypeScript

To install TypeScript you need to execute the command in Powershell:

npm install -g typescript

After the installation is complete, PowerShell will give you this output: install_success

It is possible that TS has already been installed previously. In this case, it can be updated to the latest version using the command

npm update -g typescript

To check the TypeScript version, enter the command

tsc -v

tsversion

Initializing TypeScript in a project

All that remains to be done is to connect TypeScript to your project. To do this, you need to create a file with the extension .ts in the project folder, write the code and compile it. This can be done in PowerShell with the command:

tsc

For example:

tsc app.ts
Note

First you need to move to the project folder. Otherwise, the file will not be found. On the command line, moving through folders is done with the command cd.

The compiler will create a file with the extension .js. Compilation is required after each change.

It's that easy to work with TypeScript.

  1. TypeScript.org
  2. Metanit

Contributors ✨

Thanks goes to these wonderful people (emoji key):


Philipp Dvinyaninov


Dmitriy Vasilev

💵

EnglishMoji!