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.

Duration
19m
Level
Intermediate
Students
13k students

Overview

String types can be composed and pattern-matched, which lets you type things like event names and route paths precisely.

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

Resources

TypeScript handbook

The official reference for the tools used in this lesson.