...

/

Distributed Conditional Types and the Conditional Type Inference

Distributed Conditional Types and the Conditional Type Inference

Learn about distributed conditional types and how to use them in TypeScript to derive multiple types or infer a new type based on a condition.

Distributed conditional types

When defining conditional types, instead of returning only a single type as part of our conditional statements, we can also return a number of types or distributed conditional types. As an example of this, consider the following code:

Access this course and 1400+ top-rated courses and projects.