AI Features

Conditional Types Introduction

This lesson introduces conditional types.

Introduction

Conditional types are type constructors that create a type based on some condition. In other words, they are a special kind of generic type where you can inspect the type argument and “return” a different type based on whether or not it satisfies a given type condition.

There is only one kind of condition allowed in conditional types and you can check whether the provided type argument is assignable to some type. You can think of type assignability the same way ...