TypeScript for Application Developers
LESSON 3.3

Template literal types

Learn key techniques and workflows in TypeScript for Application Developers.

19m
intermediate
12,971 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

Pro Tip

Template literal types are excellent for typed event names, and a trap when used to parse arbitrary strings.

Resources