Skip to main content
TypeScript is a language for application-scale JavaScript development. It adds optional types to JavaScript that support tools for large-scale applications for any browser, host, or OS.

Requirements

TypeScript requires Node.js version 14.17 or higher to run. Check your Node.js version:
If you need to upgrade Node.js, visit nodejs.org.

Install TypeScript

1

Choose your package manager

Install TypeScript globally or as a dev dependency in your project:
Installing as a dev dependency (-D flag) is recommended for project-specific TypeScript versions. For global installation, use npm install -g typescript.
2

Verify installation

Confirm TypeScript is installed correctly:
You should see output like:

Nightly Builds

Get the latest features and bug fixes by installing nightly builds:
Nightly builds contain experimental features and may be unstable. Use them for testing new features, not production environments.

What Gets Installed

When you install TypeScript, you get two main command-line tools:

tsc

The TypeScript compiler that transforms .ts files into JavaScript

tsserver

The TypeScript language server for editor support and tooling
Both tools are available in the bin/ directory of the installed package:
  • bin/tsc - TypeScript compiler
  • bin/tsserver - Language server for IDE integration

Global Installation

For system-wide access to TypeScript commands:
After global installation, you can use tsc directly without npx:
Project-local installations (dev dependencies) are preferred over global installations to ensure consistent TypeScript versions across team members and CI/CD environments.

Updating TypeScript

Keep TypeScript up to date to get the latest language features and improvements:
To upgrade to a specific version:

Troubleshooting

Command not found

If tsc is not recognized after installation:
  1. Use npx for local installations:
  2. Check PATH for global installations:
    Ensure this directory is in your system PATH.
  3. Reinstall TypeScript:

Version mismatch

If different versions appear in global vs local installations:
Always use npx tsc in projects to use the local version.

Next Steps

Quickstart

Create your first TypeScript project

tsconfig.json

Configure compiler options