交集类型结合了两种或多种类型的成员。
interface Knife { cut(); } interface BottleOpener{ openBottle(); } interface Screwdriver{ turnScrew(); } type SwissArmyKnife = Knife & BottleOpener & Screwdriver; function use(tool: SwissArmyKnife){ console.log("我什么事都能做!"); tool.cut(); tool.openBottle(); tool.turnScrew(); }