Discriminating Unions
Learn how to indicate all of the possible values that a newly created type can represent.
We'll cover the following
Overview
Algebraic data types (ADTs) in functional programming can be extremely useful. We’ll discuss them in detail later on. However, in TypeScript, we can use discriminating unions (also called tagged unions) to get
From TypeScript Handbook, we have the following example:
Get hands-on with 1200+ tech skills courses.