TypeScript handbook (opens in a new tab)
The official reference for the tools used in this lesson.
Link
Widening is why your string turned into string. A const assertion keeps the literal, which is what makes union-of-literals modelling work.
Lesson 1.35m 38sIntermediate19.8k 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.