🔧
Build Tool45M+/wkApache-2.0

typescript

TypeScript is a strongly typed programming language that builds on JavaScript, adding static type definitions that help catch errors at compile time rather than

Installation

npm
npm install -D typescript
yarn
yarn add -D typescript
pnpm
pnpm add -D typescript

Import

ESM
// TypeScript is a language, not typically imported

Quick Example

usage
interface User {
  id: number;
  name: string;
  email: string;
}

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

const user: User = { id: 1, name: 'Alice', email: '[email protected]' };
console.log(greet(user));

About typescript

TypeScript is a strongly typed programming language that builds on JavaScript, adding static type definitions that help catch errors at compile time rather than runtime. Developed by Microsoft, TypeScript compiles to clean, readable JavaScript that runs in any browser, on Node.js, or in any JavaScript runtime. The type system includes interfaces, generics, union and intersection types, conditional types, mapped types, template literal types, and type inference that minimizes the amount of explicit type annotations needed. TypeScript's Language Service powers the IDE experience in VS Code and other editors, providing autocompletion, inline error detection, refactoring tools, and go-to-definition navigation. The compiler (tsc) performs type checking and optionally transpiles TypeScript to JavaScript, though many projects use tsc only for type checking while delegating transpilation to faster tools like esbuild or SWC. TypeScript has become the default choice for new JavaScript projects, with adoption across all major frameworks and libraries. The declaration file system (.d.ts) provides type information for JavaScript libraries through DefinitelyTyped, the world's largest repository of type definitions.

Quick Facts

Packagetypescript
CategoryBuild Tool
Weekly Downloads45M+
LicenseApache-2.0
Installnpm install -D typescript

Related Packages

Browse npm Packages by Category

Explore our reference of 200 popular npm packages with install commands, examples, and quick-start guides.