Hacker News new | ask | show | jobs
by conaclos 1709 days ago
In my knowledge, there are some differences:

- in error reporting: type aliases may be replaced by their definition in error reporting.

- you cannot create union types with interfaces

- legacy versions of TypeScript does not enable to create recursive type aliases such as type `List<V> = {v: V, right: List<V> | undefined }`

- interfaces with same name are merged

However the frontier between type aliases and interfaces seems more and more blur. Generally interfaces are encouraged over type aliases. I personally prefer type aliases because there are more capable and seems more elegant to me. However their poor support in error reporting makes me rely more on interfaces when possible.

1 comments

Yes the error reporting is why I prefer interfaces over types since a long time now. The definition is useless in many cases