Both name an object type, and for plain object shapes they are interchangeable: either can be implemented by a class, extended, or used as a function parameter type. The handbook says almost every interface feature is available in type; the key distinction is that a type alias cannot be re-opened.
Where they differ:
- Declaration merging. Two
interface Userdeclarations in one scope merge into one type. Twotypealiases with one name are aDuplicate identifiererror. Merging is what makes module and global augmentation (interface Window) possible. - Composition.
interface B extends Achecks thatBis compatible withAand reports a conflict at the declaration.type B = A & {...}accepts anything; a conflicting property silently becomesnever(or the whole intersection collapses toneverwhen the conflict is a discriminant). - What they can name. Only
typecan alias unions, tuples, primitives, mapped types, and conditional types. An interface can only describe an object-like type. - Implicit index signatures. A type alias of an object literal type is assignable to
Record<string, string>; an interface is not, by design, because it could still be merged with more members. - Performance and messages. The handbook says interfaces with
extendscan be cheaper for the compiler than intersections, and interface names always appear in error messages.
What to say in an interview: use interface for object shapes that are extended or augmented, type when you need unions, tuples, or type-level computation, and stay consistent within a codebase. The handbook's heuristic is "use interface until you need features from type."