Practical TypeScript

55‑70 hours · 18 modules · 76 lessons · Project: Typed API client

M1 · 4 lessonsTypeScript's Own Tools
  1. 1.1tsc: --noEmit, --watch, and reading its output
  2. 1.2Your editor as a TypeScript tool: hover, go to definition, rename, quick fixes
  3. 1.3Reading long, nested type errors
  4. 1.4Strict flags beyond strict: what each one catches and which to turn on
  5. Project stepStart the API client: strict flags, plus check and watch scripts.
M2 · 5 lessonsHarder Narrowing Cases
  1. 2.1Exhaustiveness checking with never
  2. 2.2Type guards (x is T), and when TypeScript infers them for you
  3. 2.3Assertion functions (asserts x is T)
  4. 2.4instanceof and class-based narrowing
  5. 2.5Type assertions (as): when they're justified and why they're risky
  6. Project stepModel the client's commands as a union and handle every case exhaustively.
M3 · 9 lessonsType Operators
  1. 3.1Intersection types (&): combining shapes, and how they differ from extends
  2. 3.2The wide types: unknown, object, and {}
  3. 3.3keyof
  4. 3.4The typeof type operator
  5. 3.5Indexed access types (T["key"])
  6. 3.6as const and types derived from data
  7. 3.7The satisfies operator
  8. 3.8Index signatures and noUncheckedIndexedAccess
  9. 3.9Why Object.keys returns string[]
  10. Project stepDerive command names and option types from one as const config checked with satisfies.
M4 · 4 lessonsGenerics in Practice
  1. 4.1Constraints with extends
  2. 4.2The K extends keyof T pattern
  3. 4.3Default type parameters
  4. 4.4Generic classes and containers
  5. Project stepWrite a generic request<T>() helper and a typed cache Cache<K, V>.
M5 · 4 lessonsBuilt-in Utility Types
  1. 5.1Partial, Required, Readonly; a missing property vs undefined
  2. 5.2Pick, Omit, Record
  3. 5.3Exclude, Extract, NonNullable
  4. 5.4ReturnType, Parameters, Awaited
  5. Project stepBuild create, update, and summary types from one base type.
M6 · 3 lessonsImmutability and Tuples
  1. 6.1readonly arrays and ReadonlyArray<T>
  2. 6.2Named, optional, and rest elements in tuples
  3. 6.3Updating without mutating: toSorted, with, and structuredClone
  4. Project stepMake settings and cache entries read-only; return new objects instead of changing old ones.
M7 · 5 lessonsDesigning with Types
  1. 7.1Making impossible states impossible
  2. 7.2Modeling loading, success, and error states
  3. 7.3Branded types for IDs and units
  4. 7.4Parse, don't validate
  5. 7.5When not to add more types
  6. Project stepModel each request as idle, loading, success, or error, and brand the IDs.
M8 · 4 lessonsAdvanced Functions
  1. 8.1Function overloads
  2. 8.2Typing this, and how methods lose their context
  3. 8.3Generic callbacks and higher-order functions
  4. 8.4Iterables and generators: function* and Generator<T>
  5. Project stepAdd an overloaded get() and a generator that pages through results.
M9 · 4 lessonsClasses in Depth
  1. 9.1implements and abstract
  2. 9.2Getters, setters, and static members
  3. 9.3protected, and why modern code avoids parameter properties
  4. 9.4Composition vs inheritance
  5. Project stepHide HTTP behind an interface with two classes: a real client and a fake one.
M10 · 5 lessonsErrors and Concurrent Code
  1. 10.1Custom error classes and cause
  2. 10.2The Result pattern instead of exceptions
  3. 10.3Promise.all, allSettled, race, any, and their types
  4. 10.4Timeouts and cancellation with AbortController
  5. 10.5Async iteration with for await
  6. Project stepReturn Results instead of throwing; add timeouts, cancellation, and parallel requests.
M11 · 5 lessonsData at App Boundaries
  1. 11.1Why types don't protect you at runtime
  2. 11.2Writing validators by hand with type guards
  3. 11.3Typing and validating API responses
  4. 11.4Deriving types from validators: the idea behind schema libraries
  5. 11.5Typing and validating configuration and environment variables
  6. Project stepValidate every API response with hand-written guards before it enters the app.
M12 · 4 lessonsStandard Library Essentials
  1. 12.1Regular expressions: the basics, and typed match results
  2. 12.2Intl: formatting numbers, currencies, and dates for any language
  3. 12.3Dates and times: Date pitfalls and Temporal
  4. 12.4The rarer primitives: bigint and symbol
  5. Project stepFormat prices, dates, and numbers for the user's locale; parse fields with regex.
M13 · 5 lessonsHow TypeScript Finds and Runs Code
  1. 13.1tsconfig.json in detail: target, module, rootDir, outDir, lib, types
  2. 13.2Module resolution: nodenext or bundler, and how to choose
  3. 13.3ESM and CommonJS: what you'll meet in other people's code
  4. 13.4Three ways to run TypeScript, and when to use each
  5. 13.5Organizing a project: folders, barrel files, and a module's public API
  6. Project stepReorganize the client into folders with a clear public API and build it with tsc.
M14 · 4 lessonsUntyped Code
  1. 14.1Libraries without types: declare module
  2. 14.2Ambient declarations, global types, and .d.ts files
  3. 14.3Namespaces: recognizing an older pattern
  4. 14.4OptionalIf you end up in a JavaScript project: allowJs, checkJs, and JSDoc
  5. Project stepAdd a small untyped helper package and describe it with your own .d.ts file.
M15 · 3 lessonsReviewing TypeScript Code
  1. 15.1Type-safety smells: any, as, !, @ts-ignore, and a switch that isn't exhaustive
  2. 15.2Reading unfamiliar TypeScript
  3. 15.3Reviewing AI-generated TypeScript with the same checklist
  4. Project stepReview your own client with the smell checklist and fix what you find.
M16 · 3 lessonsTesting Typed Code
  1. 16.1Structuring tests with node:test; typed fixtures and test data builders
  2. 16.2Testing asynchronous code
  3. 16.3Typed test doubles without a framework
  4. Project stepCover the client with tests, using the fake HTTP class from Module 9.
M17 · 4 lessonsPopular Libraries, Step Two
  1. 17.1zod: schemas that become types, compared with your hand-written validators
  2. 17.2axios: typed HTTP requests, and why get<User>() is a promise, not a check
  3. 17.3ts-pattern: exhaustive pattern matching over unions
  4. 17.4vitest: moving your node:test suite to a popular test framework
  5. Project stepReplace hand-written guards with Zod, try axios, and move the tests to Vitest.
M18 · 1 lessonFinal Project
  1. 18.1A typed command-line API client: validated responses (by hand, then with Zod), a disk cache, Result-based errors, and full tests
  2. Project stepShip the client: a README, a clean check run, and tests for every core feature.
Curriculum v6 · September 2026Tested with TypeScript 7.x · Node.js LTS