Lesson 4.2

Typing external data at the boundary

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

Taught byDaniel OkaforTypeScript · PostgreSQL · API design · Data modelling
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.

What this lesson covers

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

This lesson sits in TypeScript in Practice, 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:

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

Resources