typescript interface extend type code example
Example 1: typescript extend interface
//declare interface to be extended
interface Vehicle {
brand: string;
plateNumber: number;
}
interface Car extends Vehicle {}
Example 2: typescript interface
interface LabeledValue {
label: string;
}
function printLabel(labeledObj: LabeledValue) {
console.log(labeledObj.label);
}
let myObj = { size: 10, label: "Size 10 Object" };
printLabel(myObj);Try