官术网_书友最值得收藏!

Hybrid type interfaces

Hybrid type interfaces are used when we want to use the object both as a function and an object. We can call an object like a function if it implements a hybrid type interface, or we can use it as an object and access its properties. This type of interface enables you to use an interface as an object and a function, as follows:

interface Customer { 
    (name: string); 
    name: string; 
    deleteCustomer(id: number): void; 
} 
  
var c: Customer; 
c('Rajesh Gunasundaram'); 
c.name = 'Rajesh Gunasundaram'; 
c.deleteCustomer(101); 
主站蜘蛛池模板: 涟源市| 陆丰市| 信阳市| 寿光市| 新巴尔虎右旗| 平阳县| 怀化市| 禄丰县| 泾源县| 乐亭县| 齐齐哈尔市| 乐山市| 林周县| 喜德县| 平泉县| 龙州县| 志丹县| 镇雄县| 从江县| 大渡口区| 景宁| 嘉义市| 柳江县| 博爱县| 泰宁县| 宝坻区| 类乌齐县| 南昌县| 左权县| 红原县| 开原市| 林周县| 永修县| 岳普湖县| 论坛| 老河口市| 同德县| 胶州市| 紫阳县| 阿荣旗| 新田县|