interface InterfaceA {
m1: string;
}
interface InterfaceB {
m2: string;
}
type TypeAB = InterfaceA & InterfaceB;
interface X1 {
m1: string;
}
interface X2 {
m1?: string;
}
type Same = X1 & X2;
let same: Same = { m1: "This is required" };
// extending interfaces
interface InterfaceA {
m1: string;
}
interface InterfaceB {
m2: string;
}
// difference between type & interafces
type TPrimitive1 = string;
type TPrimitive2 = { m1: string };
// type can't be used to implement
class ExtendPrimitiv1 implements TPrimitive1 {
// Does not compile
}
//
interface InterfaceMergeAB extends InterfaceA, InterfaceB {
m3: string;
}