
上QQ阅读APP看书,第一时间看更新
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);