Skip to main content

Interfaces and Type Aliases

Interface vs Type Alias

0:00
LearnStep 1/2

Interface vs Type

Interface vs Type Alias

Use Interface When:

  • Defining object shapes
  • You need declaration merging
  • Working with classes
  • Building public APIs

Use Type When:

  • Creating union or intersection types
  • Defining tuple types
  • Working with primitives
  • Using mapped types

Comparison

FeatureInterfaceType
Objects
Extends✅ (via &)
Unions
Merging
Primitives
typescript