RecipesChapter 3: The Type System

Effectively Using Type Assertions

Recipe 3.10 from The TypeScript Cookbook

type Person = {
  name: string;
  age: number;
};

const ppl: Person[] = await fetch("/api/people").then((res) => res.json());
Open in TypeScript Playground →