Interfaces
Interfaces describe the shape of objects and can be extended.
Official docs
Defining Interfaces
interface User {
id: number;
name: string;
email?: string; // optional
}
function greet(user: User) {
return `Hello, ${user.name}`;
}
Extending Interfaces
interface Admin extends User {
permissions: string[];
}