Course contentsShow
← TypeScript
Lesson 368 of 1,7968. Interfaces vs Type AliasesFree lesson

Hybrid Approaches: Interfaces + Type Aliases

Combining interfaces for extensible contracts with type aliases for derived or computed types.

Hybrid Approaches: Interfaces + Type Aliases

What you'll learn: How to combine interfaces and type aliases strategically to leverage the best of both features.

The Best of Both Worlds

You don't have to choose only interfaces or only type aliases in your codebase. In fact, the most robust TypeScript codebases use both together, applying each where it shines. Use interfaces for defining extensible object contracts (especially when declaration merging or extends matters), and use type aliases for derived types, unions, intersections, and complex computed types.

When to Mix Them

Think of interfaces as blueprints for objects that might evolve—they're perfect for public APIs, class contracts, or library types that others might extend. Type aliases excel at combining or transforming those interfaces into new shapes.

// Interface: extensible base contract
interface User {
  id: string;
  name: string;
}

// Type alias: derived union from interface
type UserOrGuest = User | { sessionId: string };

// Type alias: pick specific fields
type UserPreview = {
  id: User['id'];
  name: User['name'];
};

// Interface extending another interface
interface AdminUser extends User {
  permissions: string[];
}

// Type alias: intersection for mixing concerns
type LoggedInAdmin = AdminUser & { lastLogin: Date };

Notice how the interface defines the core User structure and can be extended, while type aliases create variations and combinations without altering the original contract.

Practical Strategy

  • Define core domain models as interfaces
  • Use type aliases for unions, intersections, and computed variations
  • Extend interfaces when adding required properties
  • Use type aliases when you need to narrow or combine existing types

Key Takeaway: Interfaces define extensible contracts; type aliases create derived or computed types. Use them together to build flexible, maintainable type systems.