Programming languages · Language

TypeScript

JavaScript with types added, so the editor can catch mistakes such as a misspelt field or a missing value before the code ever runs.

Web · Open source · updated

How it works

TypeScript, released by Microsoft in 2012, is a superset of JavaScript: any JavaScript file is a valid starting point, and you add type annotations such as name: string where they help. The compiler checks that values are used consistently, then strips the types and outputs plain JavaScript, so browsers and servers never see TypeScript itself.

Types are inferred wherever possible, so much of the code needs no annotations at all. The payoff shows up in the editor: precise autocomplete, safe renaming across files and errors underlined as you type. Most popular libraries ship their own types, and tools such as Zod, Prisma and tRPC use them to carry one definition from the database to the screen.

Deno and Bun run .ts files directly, and recent Node.js versions can strip the types and run them too. In larger builds, fast tools such as esbuild and SWC remove the types while the tsc compiler does the checking, often only in the editor and in CI.

TypeScript pros and cons

Pros

  • Catches whole classes of bugs before the code runs
  • Autocomplete and refactoring become far more reliable
  • Types document the code and make large codebases easier to change
  • Can be adopted gradually, one file at a time

Cons

  • A build or check step to set up and keep running
  • Advanced types (generics, conditional types) take real effort to learn
  • Types vanish at run time, so outside data still needs validating

When to use TypeScript

Pick it when

  • Almost any JavaScript project that will grow or be shared by a team
  • Libraries and APIs whose users benefit from autocomplete
  • Full-stack apps that share types between front end and back end

Skip it when

  • A one-off script or tiny page where a build step is not worth it

TypeScript pricing

Open source

Free and open source (Apache 2.0).

Approximate, checked September 2026.What the other tools cost

TypeScript vs the alternatives

More in Programming languages

Web

All 17 Programming languages terms

Crafted in the dark. Shipped to the world.

Tell us what you are building. You get a private project space with a proposal and a line-by-line quote within a day.