New Feb 15, 2025

Conditional types in TypeScript

Top Front-end Bloggers All from 2ality – JavaScript and more View Conditional types in TypeScript on 2ality.com

A conditional type in TypeScript is an if-then-else expression: Its result is either one of two branches – which one depends on a condition. That is especially useful in generic types. Conditional types are also an essential tool for working with union types because they let us “loop” over them. Read on if you want to know how all of that works.

Scroll to top