What is TypeScript?

JavaScript Plus Types, Checked Before You Run

What is TypeScript?

TypeScript is JavaScript with a static type system bolted on. You add type annotations; the compiler checks for mistakes before the code ever runs.

3 min read Level 1/5 #typescript#intro#types
What you'll learn
  • Understand what TS is and isn't
  • See how types prevent bugs
  • Recognize TS code at a glance

TypeScript is JavaScript with a static type system. You annotate values with their expected types; the compiler checks that every use matches. Bugs caught before the code ever runs.

Side By Side

// JavaScript
function add(a, b) {
  return a + b;
}

add("1", 2);   // "12" — silent string concat, runs anyway
// TypeScript
function add(a: number, b: number): number {
  return a + b;
}

add("1", 2);
//  ~~~  Argument of type 'string' is not assignable to parameter of type 'number'.

Same logic. TypeScript catches the bad call at compile time. You ship JavaScript; TypeScript just made sure you didn’t ship a bug.

What TS Is

  • A superset of JavaScript — every valid JS is valid TS
  • A type system layered on top — annotations and inference
  • A compiler that strips types, outputting plain JS
  • A language server that powers autocomplete and refactors in every modern editor

What TS Is NOT

  • A new runtime — your code runs as plain JS in a browser or Node
  • Magically faster — types are erased at build time
  • A guarantee against ALL bugs — only the type-related ones
  • Only for big projects — works great in 30-line scripts too

What You’ll Get

Once you’re comfortable, TypeScript gives you:

  • Autocomplete that actually knows your data shapes
  • Refactor safely — renames flow through types
  • Catch bugs without running — compile-time checks
  • Document via types — types ARE the docs, always up to date
  • Confidence at scale — refactor 100k LOC and trust the compiler

The Sequence Ahead

This course builds up:

  1. Basic types (this chapter)
  2. The essentials — interfaces, unions, narrowing
  3. Function types in depth
  4. Generics
  5. The advanced toolbox — keyof, mapped, conditional types
  6. OOP with classes
  7. Real-world — tsconfig, Node, React, migrating from JS

Up Next

A 60-second setup.

Setup →