Introduction to TypeScript

TypeScript is JavaScript with static types.

It compiles to plain JS, catches errors at build time, and improves IDE tooling.

snippet
// TypeScript adds types to JavaScript
const greet = (name: string): string => {
  return `Hello, ${name}!`;
};

interface User {
  id: number;
  name: string;
  email?: string; // optional
}

Key Insights

Superset of JavaScript — all JS is valid TS

Types are erased at compile time

Use strict mode for maximum type safety

Works with any JS framework or library