Advanced TypeScript
55‑70 hours · 18 modules · 72 lessons · Project: Typed toolkit
Part A · Type-level mastery
M1 · 5 lessonsHow the Type System Works
- 1.1Structural typing and assignability
- 1.2Top and bottom types:
unknownandnever - 1.3Widening, literal freshness, and the limits of control-flow analysis
- 1.4Variance: covariance, contravariance, and
in/outannotations - 1.5Where TypeScript is unsound, and why
- Project stepStart the toolkit: sketch its public types and predict which assignments must fail.
M2 · 3 lessonsTesting and Debugging Types
- 2.1
@ts-expect-erroras a test - 2.2Writing your own
EqualandExpecthelpers - 2.3Debugging complex types: hover tricks and
Prettify - Project stepSet up type tests with
EqualandExpect; every later feature ships with them.
M3 · 4 lessonsConditional Types
- 3.1Conditional type syntax
- 3.2Distributive conditional types
- 3.3
infer: extracting types - 3.4Filtering and transforming unions
- Project stepAdd
Infer<Schema>, which extracts the value type from a schema.
M4 · 3 lessonsMapped Types
- 4.1Homomorphic mapped types
- 4.2
+/-modifiers - 4.3Key remapping with
as - Project stepTurn object schemas into types with optional and read-only fields.
M5 · 3 lessonsTemplate Literal Types
- 5.1Template literal type syntax
- 5.2
Uppercase,Capitalize, and other intrinsic string types - 5.3Extracting parts of strings: from
"/users/:id"to{ id: string } - Project stepAdd a typed route helper that extracts params from
"/users/:id".
M6 · 4 lessonsRecursive Types
- 6.1Recursive type aliases: JSON and trees
- 6.2
DeepPartialandDeepReadonly - 6.3Path types (
"user.address.city") - 6.4Recursion depth limits
- Project stepSupport nested schemas and deep paths like
"user.address.city".
M7 · 4 lessonsBuilding Your Own Type Utilities
- 7.1
Pick,Omit, andReturnTypefrom scratch - 7.2
UnionToIntersection,IsEqual, andIsAny - 7.3Readable type errors for the people who use your types
- 7.4OptionalPractice set: type-level challenges
- Project stepWrite the toolkit's own helpers and give common misuse a readable error.
M8 · 6 lessonsAdvanced Generics
- 8.1How inference picks
T - 8.2
consttype parameters - 8.3
NoInferand controlling inference sites - 8.4Variadic tuple types: typing functions like
pipeandconcat - 8.5Higher-order generic functions
- 8.6OptionalEmulating higher-kinded types
- Project stepMake the API keep literal types with
constparameters andNoInfer.
M9 · 6 lessonsPopular Libraries, Step Three: Reading Their Types
- 9.1How to read a
.d.tsfile you didn't write - 9.2Case study: how TypeScript types its own standard library (
Array.map,Object.entries,Promise.all) - 9.3
type-fest: ready-made utility types, compared with the ones you wrote - 9.4Inside
zod: howz.inferturns a schema into a type - 9.5Inside a query builder (Drizzle or Kysely): result types inferred from queries
- 9.6Inside
tRPC: sharing types between server and client without code generation - Project stepCompare your schema design with Zod's and record three decisions you would change.
M10 · 4 lessonsType-Safe API Design
- 10.1Builder and fluent APIs, and the polymorphic
thistype - 10.2A type-safe event emitter
- 10.3Type-level state machines
- 10.4The cost of cleverness: when type-level magic hurts
- Project stepAdd a fluent schema builder and a typed event emitter for validation events.
M11 · 4 lessonsExtension and Metaprogramming
- 11.1Declaration merging
- 11.2Module augmentation
- 11.3Decorators (TC39 standard), and why they need a build step today
- 11.4
usingand explicit resource management - Project stepLet users register custom validators through declaration merging.
Part B · TypeScript at scale
M12 · 4 lessonsArchitecture with Types
- 12.1Module boundaries: designing a module's public types
- 12.2Dependency injection with plain functions and interfaces
- 12.3Extensible registries: letting users add types to your library (the
Registerinterface pattern) - 12.4Typed errors across layers: domain, application, and transport
- Project stepSplit the toolkit into a core and plugins with clear public types.
M13 · 3 lessonsTypes from Outside
- 13.1Generating types from OpenAPI and JSON Schema
- 13.2Types from database schemas
- 13.3Keeping generated and hand-written types in sync
- Project stepGenerate schemas from an OpenAPI description and keep them in sync.
M14 · 5 lessonsSharing Types
- 14.1Declaration files: generating them and writing them by hand
- 14.2How TypeScript finds a package's types (
types,exports) - 14.3
isolatedDeclarations - 14.4Semantic versioning for types: what counts as a breaking change
- 14.5Supporting several TypeScript versions
- Project stepEmit declaration files, set up
exports, and write a compatibility policy.
M15 · 4 lessonsType-Checker Performance
- 15.1How the checker spends its time: instantiation, caching, and depth limits
- 15.2Measuring with
--extendedDiagnosticsand--generateTrace - 15.3Faster patterns: interfaces over intersections, annotated return types, smaller unions
- 15.4Performance budgets in CI
- Project stepMeasure the toolkit's type-check cost and fix its slowest type.
M16 · 4 lessonsLarge Codebases
- 16.1Project references and monorepos
- 16.2Incremental adoption: moving a loose codebase to strict, file by file
- 16.3Measuring type coverage and tracking
any - 16.4OptionalCodemods: changing thousands of files safely
- Project stepTurn the repo into a monorepo with project references for the core and plugins.
M17 · 4 lessonsLeading TypeScript in a Team
- 17.1A shared
tsconfig.jsonstrategy - 17.2Type-safety lint rules worth enforcing
- 17.3Review standards and an
anybudget - 17.4Upgrading TypeScript across a codebase: the 6.0 to 7.0 move as a case study
- Project stepWrite the toolkit's contributor guide: shared config, lint rules, and a review checklist.
M18 · 2 lessonsFinal Project
- 18.1Option A: publish the toolkit with type tests, declaration files, and a compatibility policy
- 18.2Option B: migrate a real open-source project to strict TypeScript and write up the results
- Project stepChoose your finale: publish the toolkit, or migrate an open-source project and publish a write-up.
- TipBonus lesson A.10 shows how to publish a package to npm.