Why TypeScript? Basic Types

What TypeScript adds, why VSCode and Slack are written in it, and how to annotate the basics: string, number, boolean, arrays, objects, and function signatures.

Step 1 of 6

Why TypeScript exists

Microsoft started TypeScript in 2012 because the VSCode codebase grew too big to keep in any one developer’s head. They needed types as a tool for navigation, refactoring, and catching typos before they shipped.

Today TypeScript is the default for serious frontend work. VSCode, Slack, Airbnb, Bloomberg Terminal, Discord, and the Next.js, React, and Vue source code itself — all TypeScript.

The pitch in one sentence: TypeScript catches user.nme as a typo before the code runs, and lets your editor offer accurate autocomplete on every variable.

Web Standard

TypeScript is a superset of JavaScript: every valid .js file is a valid .ts file. The TypeScript compiler erases all type information at build time — runtime behaviour is identical to plain JavaScript. The browser never sees a single type annotation.

Learn more on MDN