How to install TypeScript
How to install TypeScript and how to start writing your first TypeScript program:
This post will show you how to install TypeScript on your system and how to start writing typescript programs.
There are three different ways that you can use to install typescript.
Make sure than you have Node.js installed on your system. If not, you can install it from its official website nodejs.org.
You can install the installer file from their website and install it like any other apps.
Method 1: Using package manager:
This is the easiest way to install typescript. If you have installed any package manager like npm, yarn or pnpm, you can install typescript with just one line:
npm install typescript --save-dev
yarn add typescript --dev
pnpm add typescript -D
Once it is installed, you can run the typescript compiler by using:
Method 2: By using NuGet package:
We can also install typescript through VSCode while using NuGet.
You can either open Manage Nuget Package window or Nuget package manager console with the command Install-Package Microsoft.TypeScript.MSBuild to install TypeScript.
Method 3: VSCode Typescript extension:
Go to your extension tab on VSCode and search for Typescript. You can download and reload VSCode to use this extension.
Here is link to it.
It adds typescript for VSCode and also adds the typescript compiler which can be used from command line.