0Pricing
TypeScript Academy · Lesson

Defining Object Shapes with Interfaces

Use interface to describe object structure.

Welcome

Interfaces describe the shape of objects in TypeScript. They define which properties exist, their types, and whether they are optional or readonly.

Basic Interface

Define an interface with the `interface` keyword followed by property names and their types.
interface User {
  id: number;
  name: string;
  email: string;
}
const alice: User = { id: 1, name: 'Alice', email: 'a@b.com' };

All lessons in this course

  1. Defining Object Shapes with Interfaces
  2. Type Aliases for Complex Types
  3. Interface Extension and Merging
  4. Interface vs Type: When to Use Each
← Back to TypeScript Academy