Typed JavaScript at Any Scale.

TypeScript extends JavaScript by adding types.

By understanding JavaScript, TypeScript saves you time catching errors and providing fixes before you run code.

Any browser, any OS, anywhere JavaScript runs. Entirely Open Source.

tsx
const user = { firstName: "Angela", lastName: "Davis", role: "Professor" } console.log(user.name) Property 'name' does not exist on type '{ firstName: string; lastName: string; role: string; }'.2339Property 'name' does not exist on type '{ firstName: string; lastName: string; role: string; }'.Try

TypeScript 4.0 is now available

What is TypeScript?

JavaScript and More

TypeScript is an open-source language which builds on JavaScript, one of the world’s most used tools, by adding static type definitions.

Types provide a way to describe the shape of an object, providing better documentation, and allowing TypeScript to validate that your code is working correctly.

Writing types can be optional in TypeScript, because type inference allows you to get a lot of power without writing additional code.

A Result You Can Trust

All valid JavaScript code is also TypeScript code. You might get type-checking errors, but that won't stop you from running the resulting JavaScript. While you can go for stricter behavior, that means you're still in control.

TypeScript code is transformed into JavaScript code via the TypeScript compiler or Babel. This JavaScript is clean, simple code which runs anywhere JavaScript runs: In a browser, on Node.JS or in your apps.

Gradual Adoption

Adopting TypeScript is not a binary choice, you can start by annotating existing JavaScript with JSDoc, then switch a few files to be checked by TypeScript and over time prepare your codebase to convert completely.

TypeScript’s type inference means that you don’t have to annotate your code until you want more safety.

Types On Every Desk

Most of the world's JavaScript is un-typed, and inference can only go so far. To address this, the TypeScript team helps maintain

Definitely Typed - a community project to provide types and inline documentation to existing JavaScript.

This project allows the community to maintain type definitions for JavaScript libraries without putting extra pressure on their maintainers.

Consistently Good Tooling

By handling a lot of the editor integration inside TypeScript, you can get a consistent experience working in many editors.

This lets you easily jump between editors like Visual Studio, Visual Studio Code, Nova, Atom, Sublime Text, Emacs, Vim, WebStorm and Eclipse.

TypeScript's editor integration supports JavaScript, so it's quite likely you're already using TypeScript under the hood.

Evolving with Standards

The TypeScript team contributes to the TC39 committees which help guide the evolution of the JavaScript language.

When new features have reached stage 3, then they are ready for inclusion in TypeScript.

For example the TypeScript team championed proposals like Optional Chaining, Nullish coalescing Operator, Throw Expressions and RegExp Match Indices.

Migration Stories

First, we were surprised by the number of small bugs we found when converting our code.

Second, we underestimated how powerful the editor integration is.

TypeScript was such a boon to our stability and sanity that we started using it for all new code within days of starting the conversion

Felix Rieseberg at Slack covered the transition of their desktop app from JavaScript to TypeScript in their blog

Read

Get Started

Install TypeScript

You can install TypeScript via npm

npm install -g typescript

Then run the compiler via tsc

npx tsc

Learn more about how to add TypeScript to your apps in the installation page

Quarterly Releases

Our next release is 4.1, which is planned for Nov 17

4.0 Released
Aug 20

4.1 Beta
Sep 15

4.1 RC
Nov 3