TypeScript handbook (opens in a new tab)
The official reference for the tools used in this lesson.
Link
A discriminated union plus a check on the discriminant is the workhorse pattern of typed application code. Narrowing is how the compiler follows your control flow.
Lesson 1.210m 20sIntermediate21k students
This lesson sits in How the Type System Thinks, part of TypeScript for Application Developers. It assumes what came before it and leads directly into the next lesson in the module.
The official reference for the tools used in this lesson.