TypeScript: difference between `interface` and `type` — when to use which?

Key differences

Feature interface type
Declaration merging :white_check_mark: Yes :cross_mark: No
Extends other types extends keyword & intersection
Primitive aliases :cross_mark: No :white_check_mark: Yes
Computed properties :cross_mark: No :white_check_mark: Yes
Union types :cross_mark: No :white_check_mark: Yes

Use interface for:

  • Object shapes — especially when working with classes
  • Public API types in libraries (supports declaration merging)
  • OOP patterns

Use type for:

  • Unions: type Status = 'active' | 'inactive' | 'pending'
  • Mapped types: type Partial<T> = { [K in keyof T]?: T[K] }
  • Utility compositions: type AdminUser = User & { role: 'admin' }
  • Primitives: type ID = string | number

Deloitte team convention: use interface for component props and data models, type for unions and utility types.