DEV Community

Rogério Rodrigues de Alcântara
Rogério Rodrigues de Alcântara

Posted on

Types Aliases and Interface are tricky..

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:

Top comments (0)

Image of Docusign

🛠️ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more