- Expert Angular
- Mathieu Nayrolles Rajesh Gunasundaram Sridhar Rao
- 88字
- 2021-07-15 17:05:32
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);