← All open source projects

TypeScript

microsoft/TypeScript

TypeScript adds static types, a compiler, and a language service to JavaScript for large applications.

Forks 13,436
Author microsoft
Language TypeScript
License Apache-2.0
Synced 2026-06-07

What it is

TypeScript is a language on top of JavaScript that adds static types and compiles to ordinary JavaScript. The output remains understandable to browsers, Node.js, and other runtimes, while developers get type checking, completion, and project navigation before the program runs.

The microsoft/TypeScript repository contains the compiler, language service, tests, documentation, and release infrastructure for the `typescript` package. This is where versions come from before they are installed through npm and used by editors.

How it appeared and why it stuck

TypeScript appeared as a response to growing JavaScript applications. In a small codebase, the language’s dynamic nature is convenient. When a project grows to hundreds of modules and several teams, data shapes, function contracts, and rename safety become more important.

The language stuck because migration can be gradual. It can be added file by file, then external library types can be introduced, then stricter rules can be enabled. The JavaScript ecosystem remains usable.

What is inside

The main parts are the `tsc` compiler, type checker, syntax transformation, editor language server, and compatibility tests. One important current detail: some new fixes and future-version work have moved toward the neighboring TypeScript Go project, so contribution scope in the main repository is now narrower.

A typed function

This example shows the basic point of TypeScript: the function contract sits next to the code, and a wrong data shape can be caught before runtime.

Language: TypeScript
type User = {
  id: number;
  name: string;
};

function formatUser(user: User): string {
  return `${user.id}: ${user.name}`;
}

formatUser({ id: 7, name: "Ada" });

Where it helps

TypeScript is especially useful in applications with many screens, API contracts, shared components, and long-lived code. It lowers the cost of change: the editor shows affected places and the compiler catches some failures before tests.

For tiny throwaway scripts, types can feel unnecessary. But once data starts moving between layers of an application, explicit types help keep less in your head.

Strengths and limits

The strength is compatibility with JavaScript and powerful editor support. TypeScript does not ask teams to throw away the ecosystem; it adds a checking layer on top.

The limitation is that types do not prove a whole program correct. They help with data shape and contracts, but do not replace tests, input validation, or architectural judgment.