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

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); 
主站蜘蛛池模板: 湛江市| 阿拉善盟| 罗源县| 沅陵县| 保德县| 普安县| 无为县| 视频| 年辖:市辖区| 阿图什市| 兴业县| 琼中| 孟津县| 天水市| 曲沃县| 天门市| 营口市| 西城区| 孝昌县| 蒲城县| 琼结县| 高尔夫| 安新县| 泗阳县| 鹰潭市| 三亚市| 临泽县| 申扎县| 兴文县| 南宁市| 长丰县| 太仓市| 梅州市| 台州市| 高雄县| 湘乡市| 西峡县| 靖宇县| 新源县| 嘉黎县| 灵石县|