Also, an interface can be extended in several locations while a type has to be fully defined in one place. For me that's +100pts for types because when I can be sure by looking at a type def that I have the whole object, while interfaces definitions can be scattered all around, possibly in different files:
// okinterfaceIUser{name:string}interfaceIUser{age:number}constifn=(user:IUser)=>`${user.name} is ${user.age} years old`// errortypeTUser={name:string}typeTUser=TUser&{age:number}// oktypeTUser={name:string;age:number}consttfn=(user:TUser)=>`${user.name} is ${user.age} years old`
Also, an interface can be extended in several locations while a type has to be fully defined in one place. For me that's +100pts for types because when I can be sure by looking at a type def that I have the whole object, while interfaces definitions can be scattered all around, possibly in different files:
docs / playground
Agreed, declaration merging sure can introduce some tricky things.