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:
node --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:
npm install -D typescript
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:
npx tsc --version
You should see output like:
Version 6.0.0

Nightly Builds

Get the latest features and bug fixes by installing nightly builds:
npm install -D typescript@next
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:
npm install -g typescript
After global installation, you can use tsc directly without npx:
tsc --version
tsc myfile.ts
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:
npm update typescript
To upgrade to a specific version:
npm install -D [email protected]

Troubleshooting

Command not found

If tsc is not recognized after installation:
  1. Use npx for local installations:
    npx tsc --version
    
  2. Check PATH for global installations:
    npm config get prefix
    
    Ensure this directory is in your system PATH.
  3. Reinstall TypeScript:
    npm uninstall typescript
    npm install -D typescript
    

Version mismatch

If different versions appear in global vs local installations:
# Check local version
npx tsc --version

# Check global version
tsc --version
Always use npx tsc in projects to use the local version.

Next Steps

Quickstart

Create your first TypeScript project

tsconfig.json

Configure compiler options

Build docs developers (and LLMs) love