Both type and interface can describe object shapes, and in most codebases either works fine. Here is the simple rule of thumb:
- Use
interfacefor object shapes and class contracts (supports declaration merging). - Use
typefor unions ('idle' | 'loading'), tuples, primitives, and mapped types.
ADVERTISEMENT