TypeScript for Application Developers
LESSON 4.2

Typing external data at the boundary

Learn key techniques and workflows in TypeScript for Application Developers.

7m
intermediate
10,686 students

Overview

Data from the network is unknown until you prove otherwise. A runtime schema validates it once and gives you a static type for free.

In this lesson you will:

  • Parse unknown input instead of casting it
  • Derive a static type from a runtime schema
  • Fail loudly at the boundary rather than deep inside

Pro Tip

Use caching and revalidation wisely to ensure your app stays fast and data remains fresh without unnecessary requests.

Resources