TypeScript

Types vs interfaces

  • type aliases can act sort of like interfaces, however, there are 3 important differences ( union types, declaration merging)

  • use whatever suites you and your team, just be consistent

  • always use interface for public API's definition when authoring a library or 3rd party ambient type definitions

  • consider using type for your React Component Props and State

Last updated

Was this helpful?