type
any
typeinterface
interface
is always in object shape
, not primitives
interfaces
can use extends
to inherit from another interface
You should use types
by default unless you need a specific feature of interfaces
type
and interface
togetherinterface
over type
when type extension
is involvedWhen you're working with objects that inherit from each other, use interfaces
extends
makes TypeScript's type checker run slightly faster than using &
// extending interface interface IShrimpFriedRice extends IFriedRice { ingredients: IShrimp, } // extending type type Latte = { liquid: Coffee } & Milk