Skip to content

Course

TypeScript in Practice

Structural typing, narrowing, discriminated unions, generics that earn their keep, strict tsconfig, and honest types at untrusted boundaries — TypeScript past the tutorial.

9 lessons

Course Q&A

Types the way JavaScript actually works

Structural typing, narrowing, and discriminated unions — modeling real data instead of pretending classes exist.

  1. 01Structural typing: shapes matter, names don'tWhy TypeScript checks shapes instead of names, what excess property checking really does, and where duck typing bites.20mOpen
  2. 02Narrowing: control flow as a type system featuretypeof, in, instanceof, type predicates, and the truthiness bug that ships to production.22mOpen
  3. 03Discriminated unions: one field decides the whole shapeModeling results, requests, and auth states as tagged unions — and enforcing exhaustiveness with never.25mMembers

Generics and the type-level toolkit

Generics that relate two positions, keyof and mapped types, and conditional types with infer — plus where to stop.

  1. 01Generics that earn their keepWhen a generic is just any in a trench coat, how inference sites work, constraints, and the covariance trap in arrays.25mMembers
  2. 02keyof and mapped types: derive, don't duplicateTurn kept-in-sync-by-hope into derived-from-one-source with keyof, Record, Pick, and friends.25mMembers
  3. 03Conditional types and infer, without the rabbit holeextends ternaries on types, distributivity over unions, infer for pattern matching — and where to stop.28mMembers

Types in production

Strict flags worth turning on, typing untyped third-party and legacy code, and keeping types honest at the boundaries.

  1. 01tsconfig strict flags worth turning onBeyond strict: noUncheckedIndexedAccess, exactOptionalPropertyTypes, and the quiet flags that prevent real bugs.25mPremium
  2. 02Typing the untyped: third-party and legacy codedeclare module, @types packages, checkJs, and an honest escalation ladder from unknown to any to ts-expect-error.30mPremium
  3. 03Keeping types honest at the boundaryJSON.parse is any, as is a lie you typed, schema validation at the seam, and branding for nominal identity.30mPremium