TypeScript 7 · Types

Define an object type

Describe the shape of an object with an interface.

interface User {
  id: number;
  name: string;
  email?: string;
}

Official TypeScript 7 documentation

More types commands

All types commands · TypeScript 7 cheatsheet

Was this page helpful?