TypeScript is a superset of JavaScript - every valid JavaScript file is already valid TypeScript - that adds an optional type system, checked at compile time and erased before the code reaches the browser.

function formatPrice(cents: number): string {
  return (cents / 100).toFixed(2);
}

formatPrice("42"); // caught at compile time, not in production

Interfaces describe shapes, not just types

interface Project {
  title: string;
  year: number;
  client?: string; // optional
}

This is where the real value shows up on larger codebases: an editor that knows the exact shape of an object can autocomplete its fields and flag a typo instantly, instead of failing silently at runtime with undefined.

Adopting it gradually

TypeScript can be introduced file by file in an existing JavaScript project - nothing forces a full rewrite on day one, which has made it a realistic addition to codebases we didn't start from scratch.

Catching a category of bug before it ships

function greet(name: string): string {
  return `Hello, ${name}`;
}
greet(42); // Error: Argument of type 'number' is not assignable to type 'string'

That error surfaces in the editor, before the code ever runs - a whole class of "undefined is not a function" and "expected a string, got a number" runtime bugs simply can't happen for correctly-typed code, because the compiler refuses to let them ship.

You don't have to type everything on day one

TypeScript's gradual typing means an existing JavaScript file can be renamed to .ts and still compile with minimal changes, with any as an escape hatch for anything not yet worth typing properly. Migrating incrementally - new code strictly typed, old code loosely typed and tightened over time - is a far more realistic adoption path for an existing codebase than a big-bang rewrite, and it's how nearly every real migration we've done actually happened.