TypeScript

JavaScript reports a misspelled property or a missing argument only when the line runs, often in a user's browser. TypeScript adds a static type system: you describe the shape of your data, and the compiler flags mistakes as you type. The types are erased at build time, leaving the JavaScript of JavaScript.

This chapter follows the TypeScript Handbook from everyday types and narrowing to generics, conditional and mapped types, then covers classes, modules, declaration files and tsconfig.json. It targets TypeScript 7.0, the native compiler released in July 2026. Every example was checked with the real compiler, and error messages appear exactly as tsc prints them.

What you will learn:

Sections