Concepts
Interface vs Type Alias
The most-asked TypeScript question, answered feature by feature with side-by-side code.
Both can build on existing shapes — interfaces with extends, type aliases with intersections (&).
interfacetype
interface
interface Animal {
name: string;
}
interface Dog extends Animal {
breed: string;
}
// Dog = { name: string; breed: string }type
type Animal = {
name: string;
};
type Dog = Animal & {
breed: string;
};
// Dog = { name: string; breed: string }Good to know: extends produces clearer error messages and is slightly faster for the compiler on deep hierarchies. Intersections are more flexible — they can combine unions and primitives too.