<>
25
TypeScript advanced types

TypeScript advanced types

The corners that let library authors do what they do. Eight lessons on conditional types, mapped types, infer, and when to stop.

~ 135 min·8 lessons·updated apr 2026

What you'll learn


Lessons

Read in order. Each lesson stands on its own, but the order is deliberate.

8 lessons · ~135 min total

  1. 01
    Conditional types
    T extends U ? X : Y, and why unions split when you ask one question.
    18 min
  2. 02
    Using infer
    Pulling a type out from inside another. Position is everything.
    17 min
  3. 03
    Mapped types
    Walk every key. Add modifiers. Rename with as. Reshape on demand.
    18 min
  4. 04
    Template literal types
    Strings as types, joined by interpolation. Event names, routes, CSS keys.
    18 min
  5. 05
    Recursive types
    Types that call themselves. JSON, deep paths, and the depth limit.
    16 min
  6. 06
    Variance, briefly
    Why a callback for Animal accepts a callback for Dog — but not the other way.
    14 min
  7. 07
    Utility types from scratch
    Pick, Omit, Partial, Required, Readonly, Awaited — each a one-liner now.
    17 min
  8. 08
    When to stop
    Cleverness has a price. The honest case for boring types.
    17 min

Prerequisites

  • · typescript-essentials
  • · typescript-design-patterns
  • · Comfortable reading library .d.ts files

After this, try

  • Library type design
  • Type-level TypeScript
  • Compiler internals