Skip to content

Latest commit

 

History

History
25 lines (16 loc) · 1.16 KB

consistent-type-definitions.md

File metadata and controls

25 lines (16 loc) · 1.16 KB

Consistent Type Definitions

Decision

Libraries should prefer interfaces over type aliases.

Other packages should prefer type aliases over interfaces.

Rationale

Type aliases support unions, primitives, shorthand functions, and advanced type functions.

Interfaces support declaration merging. This is especially important for libraries as it allows consumers to extend type definitions.

Because an ideal property of software is being open to extension, you should always use an interface over a type alias if possible.

-- TypeScript

References