TypeScript for Application Developers
LESSON 3.1

Conditional types and infer

Learn key techniques and workflows in TypeScript for Application Developers.

14m
intermediate
15,256 students

Overview

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

In this lesson you will:

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

Pro Tip

Use caching and revalidation wisely to ensure your app stays fast and data remains fresh without unnecessary requests.

Resources