TypeScript Compiler (Deprecated `tsc` package)

2.0.4 · deprecated · verified Sun Apr 19

The `tsc` npm package is a **deprecated** placeholder that offered an older, unsupported release of the TypeScript compiler. Users seeking the TypeScript compiler's command-line interface (`tsc`) should install the official `typescript` npm package instead. The current stable version of the `typescript` package is 6.0.3, released recently (as of April 2026). TypeScript generally follows a quarterly release cadence for major versions, with monthly patch updates to address bugs and regressions. Key differentiators of the `typescript` package include its comprehensive static type-checking capabilities, support for modern ECMAScript features, and rich tooling integration. It transpile TypeScript code into various JavaScript targets, ensuring broad compatibility across browsers and Node.js environments.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to install and use the `tsc` command-line interface provided by the official `typescript` npm package to compile a basic TypeScript project.

/*
  This quickstart demonstrates how to set up and use the actual TypeScript compiler (tsc) 
  by installing the officially supported 'typescript' npm package.
*/

// 1. Initialize a new Node.js project
// npm init -y

// 2. Install the official TypeScript compiler as a development dependency
// npm install --save-dev typescript

// 3. Initialize a tsconfig.json file for your project (optional, but recommended)
// npx tsc --init

// 4. Create a TypeScript file (e.g., src/index.ts)
// (You would typically create this file manually or through your IDE)

// src/index.ts
interface User {
  id: number;
  name: string;
  email?: string;
}

function greetUser(user: User): string {
  return `Hello, ${user.name} (ID: ${user.id})!`;
}

const newUser: User = {
  id: 1,
  name: 'Alice',
  email: 'alice@example.com',
};

console.log(greetUser(newUser));

// 5. Compile your TypeScript code to JavaScript
// npx tsc

// This will create a 'dist' folder (or your configured outDir) with index.js
// You can then run the compiled JavaScript:
// node dist/index.js

// Output in console: Hello, Alice (ID: 1)!

view raw JSON →