Typescript: Interfaces vs. Type Aliases

tl;dr Prefer interface types over type aliases.

First, let’s take a look at what the spec says:

Interface types have many similarities to type aliases for object type literals, but since interface types offer more capabilities they are generally preferred to type aliases.

But what are these capabilities? Well, interfaces can be extended in a very similar manner to classes

interface Plant {
  color: string
  height: number

interface Cactus extends Plant {
  spineCount: number

as well as augmented or merged allowing for properties to be added later on down the line:

interface Cactus extends Plant {}

interface Spine {
  length: number

// ...then later on
interface Cactus {
  spines: Spine[]

In many cases, an interface can be written as a type alias, but the following flexibility is lost (from the spec):

  • An interface can be named in an extends or implements clause, but a type alias for an object type literal cannot.
  • An interface can have multiple merged declarations, but a type alias for an object type literal cannot.