There are three ways to install TypeScript:
- Install TypeScript as an NPM package on your local machine or in your project.
- Install TypeScript NuGet Package in your .NET or .NET Core project.
- Install TypeScript as a Plug-in in your IDE (Integrated Development Environment).
Install TypeScript using NPM
To install or update the latest version of TypeScript, open command prompt/terminal and type the following command:npm install -g typescript
The above command will install TypeScript globally so that you can use it in any project. Check the installed version of TypeScript using the following command:tsc -v
Execute the following command to install the TypeScript to your local project as dev dependency.npm install typescript --save-dev
Install TypeScript as NuGet Package
For .NET or .NET Core projects, TypeScript can be installed as a NuGet package in your project.
The NuGet package Microsoft.TypeScript.MSBuild is an MSBuild task for TypeScript, which will automatically compile all
.ts files to
.js files as per
tsconfig.json configuration when you build your project.
To install the TypeScript NuGet package, open NuGet Package Manager by right-clicking on a project node, click
Manage NuGet Packages.., and search for typescript in the
Browse tab. It will list all the packages related to TypeScript.
Select Microsoft.TypeScript.MSBuild and click on the Install button.
This will install TypeScript in your local ASP.NET project.
TypeScript Visual Studio Extension
If your project type does not support the NuGet packages, then you can use TypeScript Visual Studio Extension. You can find and install the extension in Visual Studio from Tools > Extensions and Updates menu.
Visual Studio Code comes with built-in support for TypeScript.
Install TypeScript Plug-in in your IDE
You can install an IDE specific TypeScript package or plugin for your IDE.
A few examples of plugins for popular code editors are:
- Atom-TypeScript: a TypeScript language service for Atom developed by TypeStrong.
- TypeScript IDE for Eclipse: an Eclipse plugin developed by Angelo Zerr.
- TypeScript Plug-in for Eclipse: an Eclipse plugin developed by Palantir.
- WebStorm includes TypeScript support out of the box.
Visit TypeScript Github Repository for the full list of IDEs that support TypeScript development.
TypeScript provides an online playground https://www.typescriptlang.org/play to write and test your code on the fly without the need to download or install anything.
This is a great place for beginners to learn TypeScript and try different TypeScript features. You also have the option to share your code via a shareable link provided by the playground.