Greg Pabian
Aug 27, 2024

I think you described well the core differences between the types and interfaces. I would add that interfaces have a long standing historical importance due to OOP (as used in C++, Java). Additionally, if you inspect the type statements in the abstract syntax tree of TS, the compiler actually calls them type aliases; which hints it's just a name to describe an structure. Generally, we import types when we use them but that doesn't usually happen with interfaces. I would add also abstract classes to the mix, because in some ways they work similar to types and interfaces.

Greg Pabian
Greg Pabian

Written by Greg Pabian

A Full-stack Software Engineer that loves building products. Disclaimer: https://gist.github.com/grzpab/3cf57878ffce7d5271298ccc473bcb98

Responses (1)