type BirdType = {
wings: 2;
};
interface BirdInterface {
wings: 2;
}
- 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)