All courses
· intermediate

TypeScript

Types that catch mistakes before anyone runs the code. Inference doing most of the work, narrowing that makes checks provable, and why the types disappear the moment the program starts.

Pathaxis · Original content

Written in house, from the work rather than from a syllabus. Every example is one we would use ourselves, and every quiz question explains why its answer is right.

83 min 6 lessons 15 quiz questionsStart course

What you’ll learn

  • Explain what the compiler checks, and that nothing is checked at runtime
  • Let inference do the work instead of annotating everything
  • Model data with unions so invalid combinations cannot be written
  • Narrow a union so the compiler proves a check for you
  • Write a simple generic without reaching for any
  • Validate data at the boundary, where types stop being guarantees

Before you start

  • · JavaScript Fundamentals, or equivalent
  • · No prior TypeScript

Syllabus

01

What it does

Compile time, inference and annotations.

02

Modelling data

Unions, narrowing and making bad states impossible.