Types Aliases and Interface are tricky..

Rogério Rodrigues de Alcântara - Jul 5 '23 - - Dev Community
type BirdType = {
  wings: 2;
};

interface BirdInterface {
  wings: 2;
}
Enter fullscreen mode Exit fullscreen mode
  • Both declare the shape of an object
  • Both support extending other interfaces and types
  • It's possible to intermix their use
  • Interfaces are open whereas type aliases are closed
  • Typescript gives better error messages for interfaces
  • Prefer interfaces for publicly exposed types

Sources:

. . . . . . . . . . . . .
Terabox Video Player