- Expert Angular
- Mathieu Nayrolles Rajesh Gunasundaram Sridhar Rao
- 69字
- 2021-07-15 17:05:34
Generic interfaces
We can also define generic interfaces using the T type variable, as follows:
interface GenericFunc<T> { (arg: T): T; } function func<T>(arg: T): T { return arg; } var myFunc: GenericFunc<number> = func;
Here, we defined a generic interface and the myFunc variable of the GenericFunc type, passing the number data type for the T type variable. Then, this variable is assigned with a function named func.
推薦閱讀
- Advanced Quantitative Finance with C++
- Python程序設計教程(第2版)
- Django開發從入門到實踐
- 從學徒到高手:汽車電路識圖、故障檢測與維修技能全圖解
- Securing WebLogic Server 12c
- HTML5 and CSS3 Transition,Transformation,and Animation
- Go并發編程實戰
- 單片機C語言程序設計實訓100例
- Arduino家居安全系統構建實戰
- RESTful Java Web Services(Second Edition)
- Spring Boot+MVC實戰指南
- 代替VBA!用Python輕松實現Excel編程
- Bootstrap for Rails
- JSP程序設計與案例實戰(慕課版)
- PyQt編程快速上手