Rozšíření typů
Je možné rozšířit interface (zkopírovat členy z jiného typu):
interface X { a: string;}interface Y extends X { b: string;}Je také možné dědit z více typů:
interface A { a: string;}interface B { b: string;}interface Y extends A, B { y: string;}Klíčové slovo extends funguje pouze u rozhraní a tříd; u typů použijte průnik:
type A = { a: number;};type B = { b: number;};type C = A & B;Typ lze rozšířit pomocí rozhraní, ale ne naopak:
type A = { a: string;};interface B extends A { b: string;}