TS 加强语法
Pick 获取接口一些类型
interface MyType extends Pick < 原接口 ,’字段‘ | ’字段2‘>
Omit 在原接口排除一些类型
interface MyType extends Oimt < 原接口 ,’排除的字段‘ | ’字段2‘>
Partial 在原接口转换为可选
type myType=Partial<原接口>
async 装饰函数会返回一个promise return的内容就是promise 的resolve async 和 await 一起使用 await 等待异步操作resolve后才会执行下一行 Promise.all(异步数组)等待异步数组都是resolve状态后,才会变成resolve
数组高阶
01 forEach((item,index ,self)=>) 遍历数组,item被遍历的项, index遍历的下标,self当前数组
02 map((item,index,self)=>{}) 根据现有的数组返回一个新的数组
03 filter((item,index,self)=>{}) 如果回调函数返回true,保留当前数组元素,返回false则移除
04 reduce((a,b)=>{}) 上一次回调函数结果是这一个a参数 累计,查找,递归
05 some((item,index , self)=>{}) 如果回调函数有一个返回的结果为true,最终返回结果为true
06 every((item,index ,self)=>{}) 如果回调函数所有个一返回为false最终返回结果为false 全部返回为true最终返回为true
07 findIndex( (item,index,self)=>{}) 如果回调函数返回true,这最终结果为前遍历的index
08 find((item,index, self)=>{}) 如果回调函数返回true,这最终结果为前遍历的item
09 sort((a,b)=>) 根据a, b属性排序