摘要: 11.1、类型别名 // type aliase // 普通写法 let sum: (x: number, y: number) => number const result = sun(1, 2) // 类型别名写法 type PlusType = (x: number, y: number) = 阅读全文
posted @ 2021-04-19 19:32 史小坑 阅读(49) 评论(0) 推荐(0) 编辑
摘要: 概念:泛型(Generics)是指在定义函数、接口或者类的时候, 不预先指定其类型,而是在使用是手动指定其类型的一种特性 10.1、使用场景 我们需要创建一个函数, 这个函数会返回任何它传入的值。 function identity (arg: any): any { return arg } id 阅读全文
posted @ 2021-04-19 19:29 史小坑 阅读(233) 评论(0) 推荐(0) 编辑