- All Courses
- TypeScript for Application Developers
- How the Type System Thinks
- Literal types and const assertions
Literal types and const assertions
Widening is why your string turned into string. A const assertion keeps the literal, which is what makes union-of-literals modelling work.
- 6m
- Intermediate

Video by Matt Pocock · YouTube
Check your understanding
3 questions. Unlocks when you finish the video.
Overview
What this lesson covers
- Understand literal widening and when it happens
- Freeze a literal shape with as const
- Derive a union of allowed values from a constant array
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.
In this lesson you will:
- Understand literal widening and when it happens
- Freeze a literal shape with as const
- Derive a union of allowed values from a constant array
Resources
Your notes will live here
Note taking is not available yet. Nothing you type would be saved, so the tab stays read-only for now.