1.ts
https://blog.csdn.net/lan7798/article/details/127607160
https://blog.csdn.net/yasinawolaopo/article/details/122472943
1.1typeScript接口
类实现了一个接口
https://blog.csdn.net/u014388408/article/details/130789117
interface IWithLength {
length: number
}
function echoWithLength<T extends IWithLength>(arg: T): T {
console.log(arg.length)
return arg
}
const len01 = echoWithLength('abc') // 3
const len02 = echoWithLength({ length: 12 }) // 12
const len03 = echoWithLength([1, 2, 3]) // 3
2.泛型
https://blog.csdn.net/qq_40280582/article/details/112444461
https://blog.csdn.net/qq_33221861/article/details/112369522
https://www.cnblogs.com/jing-zhe/p/13061969.html
在调用泛型函数或实例化时,需要在尖括号内指定类型参数的具体类型
https://blog.csdn.net/qq_34185872/article/details/130551882