Lesson 3.114mIntermediate15.3k students

Conditional types and infer

A conditional type branches on assignability, and infer pulls a type out of the branch it matched. This is how utility types are built.

This lesson sits in Advanced Types, part of TypeScript for Application Developers. It assumes what came before it and leads directly into the next lesson in the module.

In this lesson you will

  • Branch a type on an extends check
  • Extract inner types with infer
  • Understand distribution over union members

Resources