Need Assistance?

support@tutorialshub.in

Objects, Type Aliases & Interfaces

type Aliases vs interface

ADVERTISEMENT
TypeScript Free Lesson
5 min read
ADVERTISEMENT

Both type and interface can describe object shapes, and in most codebases either works fine. Here is the simple rule of thumb:

  • Use interface for object shapes and class contracts (supports declaration merging).
  • Use type for unions ('idle' | 'loading'), tuples, primitives, and mapped types.
ADVERTISEMENT
Hi, I'm Tuby! Here to help you