Defining a TypeScript Interface

Learn how to create a TypeScript interface to define the structure of complex data objects, providing better type checking and code documentation.

Defining a TypeScript Interface
Photo by Nangialai Stoman / Unsplash

Learn how to create a TypeScript interface to define the structure of complex data objects, providing better type checking and code documentation.

interface Person {
  firstName: string;
  lastName: string;
  age: number;
}

const person: Person = {
  firstName: "John",
  lastName: "Doe",
  age: 30,
};