Lesson 3.3
Template literal types
String types can be composed and pattern-matched, which lets you type things like event names and route paths precisely.
19mIntermediate12,971 students

Sign in to watch this lesson
Browsing is free. Create an account to play videos and track your progress.
Overview
String types can be composed and pattern-matched, which lets you type things like event names and route paths precisely.
What this lesson covers
- Compose string types from other types
- Constrain string shapes such as event or route names
- Combine template literals with key remapping
This lesson sits in Advanced Types, 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:
- Compose string types from other types
- Constrain string shapes such as event or route names
- Combine template literals with key remapping
Pro Tip
Template literal types are excellent for typed event names, and a trap when used to parse arbitrary strings.