How to install typescript
How to install typescript
Download TypeScript
TypeScript can be installed through three installation routes depending on how you intend to use it: an npm module, a NuGet package or a Visual Studio Extension.
If you are using Node.js, you want the npm version. If you are using MSBuild in your project, you want the NuGet package or Visual Studio extension.
TypeScript in Your Project
Having TypeScript set up on a per-project basis lets you have many projects with many different versions of TypeScript, this keeps each project working consistently.
via npm
You will need a copy of Node.js as an environment to run the package. Then you use a dependency manager like npm, yarn or pnpm to download TypeScript into your project.
All of these dependency managers support lockfiles, ensuring that everyone on your team is using the same version of the language. You can then run the TypeScript compiler using one of the following commands:
with Visual Studio
For most project types, you can get TypeScript as a package in Nuget for your MSBuild projects, for example an ASP.NET Core app.
For project types which don’t support Nuget, you can use the TypeScript Visual Studio extension. You can install the extension using Extensions > Manage Extensions in Visual Studio.
The examples below are for more advanced use cases.
Globally Installing TypeScript
It can be handy to have TypeScript available across all projects, often to test one-off ideas. Long-term, codebases should prefer a project-wide installation over a global install so that they can benefit from reproducible builds across different machines.
via npm
You can use npm to install TypeScript globally, this means that you can use the tsc command anywhere in your terminal.
An alternative is to use npx when you have to run tsc for one-off occasions.
via Visual Studio Marketplace
You can install TypeScript as a Visual Studio extension, which will allow you to use TypeScript across many MSBuild projects in Visual Studio.
Working with TypeScript-compatible transpilers
There are other tools which convert TypeScript files to JavaScript files. You might use these tools for speed or consistency with your existing build tooling.
Babel
Babel is a very popular JavaScript transpiler which supports TypeScript files via the plugin @babel/plugin-transform-typescript.
swc is a fast transpiler created in Rust which supports many of Babel’s features including TypeScript.
Sucrase
Sucrase is a Babel fork focused on speed for using in development mode. Sucrase supports TypeScript natively.
Download TypeScript
TypeScript can be installed through three installation routes depending on how you intend to use it: an npm module, a NuGet package or a Visual Studio Extension.
If you are using Node.js, you want the npm version. If you are using MSBuild in your project, you want the NuGet package or Visual Studio extension.
TypeScript in Your Project
Having TypeScript set up on a per-project basis lets you have many projects with many different versions of TypeScript, this keeps each project working consistently.
via npm
You will need a copy of Node.js as an environment to run the package. Then you use a dependency manager like npm, yarn or pnpm to download TypeScript into your project.
All of these dependency managers support lockfiles, ensuring that everyone on your team is using the same version of the language. You can then run the TypeScript compiler using one of the following commands:
with Visual Studio
For most project types, you can get TypeScript as a package in Nuget for your MSBuild projects, for example an ASP.NET Core app.
For project types which don’t support Nuget, you can use the TypeScript Visual Studio extension. You can install the extension using Extensions > Manage Extensions in Visual Studio.
The examples below are for more advanced use cases.
Globally Installing TypeScript
It can be handy to have TypeScript available across all projects, often to test one-off ideas. Long-term, codebases should prefer a project-wide installation over a global install so that they can benefit from reproducible builds across different machines.
via npm
You can use npm to install TypeScript globally, this means that you can use the tsc command anywhere in your terminal.
An alternative is to use npx when you have to run tsc for one-off occasions.
via Visual Studio Marketplace
You can install TypeScript as a Visual Studio extension, which will allow you to use TypeScript across many MSBuild projects in Visual Studio.
Working with TypeScript-compatible transpilers
There are other tools which convert TypeScript files to JavaScript files. You might use these tools for speed or consistency with your existing build tooling.
Babel
Babel is a very popular JavaScript transpiler which supports TypeScript files via the plugin @babel/plugin-transform-typescript.
swc is a fast transpiler created in Rust which supports many of Babel’s features including TypeScript.
Sucrase
Sucrase is a Babel fork focused on speed for using in development mode. Sucrase supports TypeScript natively.
Download TypeScript
TypeScript can be installed through three installation routes depending on how you intend to use it: an npm module, a NuGet package or a Visual Studio Extension.
If you are using Node.js, you want the npm version. If you are using MSBuild in your project, you want the NuGet package or Visual Studio extension.
TypeScript in Your Project
Having TypeScript set up on a per-project basis lets you have many projects with many different versions of TypeScript, this keeps each project working consistently.
via npm
You will need a copy of Node.js as an environment to run the package. Then you use a dependency manager like npm, yarn or pnpm to download TypeScript into your project.
All of these dependency managers support lockfiles, ensuring that everyone on your team is using the same version of the language. You can then run the TypeScript compiler using one of the following commands:
with Visual Studio
For most project types, you can get TypeScript as a package in Nuget for your MSBuild projects, for example an ASP.NET Core app.
For project types which don’t support Nuget, you can use the TypeScript Visual Studio extension. You can install the extension using Extensions > Manage Extensions in Visual Studio.
The examples below are for more advanced use cases.
Globally Installing TypeScript
It can be handy to have TypeScript available across all projects, often to test one-off ideas. Long-term, codebases should prefer a project-wide installation over a global install so that they can benefit from reproducible builds across different machines.
via npm
You can use npm to install TypeScript globally, this means that you can use the tsc command anywhere in your terminal.
An alternative is to use npx when you have to run tsc for one-off occasions.
via Visual Studio Marketplace
You can install TypeScript as a Visual Studio extension, which will allow you to use TypeScript across many MSBuild projects in Visual Studio.
Working with TypeScript-compatible transpilers
There are other tools which convert TypeScript files to JavaScript files. You might use these tools for speed or consistency with your existing build tooling.
Babel
Babel is a very popular JavaScript transpiler which supports TypeScript files via the plugin @babel/plugin-transform-typescript.
swc is a fast transpiler created in Rust which supports many of Babel’s features including TypeScript.
Sucrase
Sucrase is a Babel fork focused on speed for using in development mode. Sucrase supports TypeScript natively.
Download TypeScript
TypeScript can be installed through three installation routes depending on how you intend to use it: an npm module, a NuGet package or a Visual Studio Extension.
If you are using Node.js, you want the npm version. If you are using MSBuild in your project, you want the NuGet package or Visual Studio extension.
TypeScript in Your Project
Having TypeScript set up on a per-project basis lets you have many projects with many different versions of TypeScript, this keeps each project working consistently.
via npm
You will need a copy of Node.js as an environment to run the package. Then you use a dependency manager like npm, yarn or pnpm to download TypeScript into your project.
All of these dependency managers support lockfiles, ensuring that everyone on your team is using the same version of the language. You can then run the TypeScript compiler using one of the following commands:
with Visual Studio
For most project types, you can get TypeScript as a package in Nuget for your MSBuild projects, for example an ASP.NET Core app.
For project types which don’t support Nuget, you can use the TypeScript Visual Studio extension. You can install the extension using Extensions > Manage Extensions in Visual Studio.
The examples below are for more advanced use cases.
Globally Installing TypeScript
It can be handy to have TypeScript available across all projects, often to test one-off ideas. Long-term, codebases should prefer a project-wide installation over a global install so that they can benefit from reproducible builds across different machines.
via npm
You can use npm to install TypeScript globally, this means that you can use the tsc command anywhere in your terminal.
An alternative is to use npx when you have to run tsc for one-off occasions.
via Visual Studio Marketplace
You can install TypeScript as a Visual Studio extension, which will allow you to use TypeScript across many MSBuild projects in Visual Studio.
Working with TypeScript-compatible transpilers
There are other tools which convert TypeScript files to JavaScript files. You might use these tools for speed or consistency with your existing build tooling.
Babel
Babel is a very popular JavaScript transpiler which supports TypeScript files via the plugin @babel/plugin-transform-typescript.
swc is a fast transpiler created in Rust which supports many of Babel’s features including TypeScript.
Sucrase
Sucrase is a Babel fork focused on speed for using in development mode. Sucrase supports TypeScript natively.
Download TypeScript
TypeScript can be installed through three installation routes depending on how you intend to use it: an npm module, a NuGet package or a Visual Studio Extension.
If you are using Node.js, you want the npm version. If you are using MSBuild in your project, you want the NuGet package or Visual Studio extension.
TypeScript in Your Project
Having TypeScript set up on a per-project basis lets you have many projects with many different versions of TypeScript, this keeps each project working consistently.
via npm
You will need a copy of Node.js as an environment to run the package. Then you use a dependency manager like npm, yarn or pnpm to download TypeScript into your project.
All of these dependency managers support lockfiles, ensuring that everyone on your team is using the same version of the language. You can then run the TypeScript compiler using one of the following commands:
with Visual Studio
For most project types, you can get TypeScript as a package in Nuget for your MSBuild projects, for example an ASP.NET Core app.
For project types which don’t support Nuget, you can use the TypeScript Visual Studio extension. You can install the extension using Extensions > Manage Extensions in Visual Studio.
The examples below are for more advanced use cases.
Globally Installing TypeScript
It can be handy to have TypeScript available across all projects, often to test one-off ideas. Long-term, codebases should prefer a project-wide installation over a global install so that they can benefit from reproducible builds across different machines.
via npm
You can use npm to install TypeScript globally, this means that you can use the tsc command anywhere in your terminal.
An alternative is to use npx when you have to run tsc for one-off occasions.
via Visual Studio Marketplace
You can install TypeScript as a Visual Studio extension, which will allow you to use TypeScript across many MSBuild projects in Visual Studio.
Working with TypeScript-compatible transpilers
There are other tools which convert TypeScript files to JavaScript files. You might use these tools for speed or consistency with your existing build tooling.
Babel
Babel is a very popular JavaScript transpiler which supports TypeScript files via the plugin @babel/plugin-transform-typescript.
swc is a fast transpiler created in Rust which supports many of Babel’s features including TypeScript.
Sucrase
Sucrase is a Babel fork focused on speed for using in development mode. Sucrase supports TypeScript natively.