RecipesChapter 1: Project Setup

Keeping Types on the Side

Recipe 1.3 from The TypeScript Cookbook

// @types/person.d.ts

// An interface for objects of this shape
export interface Person {
  name: string;
  age: number;
}

// An interface that extends the original one
// this is tough to write with JSDoc comments alone.
export interface Student extends Person {
  semester: number;
}
Open in TypeScript Playground →