RecipesChapter 1: Project Setup

Migrating a Project to TypeScript

Recipe 1.4 from The TypeScript Cookbook

function printPerson(person: Person) {
  console.log(person.name);
}

// This error will be swallowed
// @ts-expect-error
printPerson(123);


function printNumber(nr: number) {
  console.log(nr);
}

// v- Unused '@ts-expect-error' directive.ts(2578)
// @ts-expect-error
printNumber(123);
Open in TypeScript Playground →