Interfaces describe the shape of an object:
interface User {
id: number;
name: string;
email?: string; // optional
readonly created: Date; // can't be changed
}You've already used type aliases. Both type and interface can describe object shapes, and TypeScript cares about structural compatibility: if two shapes match, values can be used interchangeably.
Interfaces offer special features:
interface Admin extends User { role: string }[key: string]: any for flexible keysIn this category, you'll:
By the end, you'll know when to use interfaces versus type aliases and how to leverage their unique features.