随笔分类 - TypeScript
摘要:in操作符作用: 遍历类型 基本用法 type roles = "tester" | "developer" | "manager"; const staffCount: { [k in roles]: number } = { tester: 100, developer: 200, manage
阅读全文
摘要:索引:对象或数组的对应位置的名字 数组的索引就是 number 类型的 0,1,2,3... 对象的索引就是 string 类型的属性名 数字索引签名:通过定义接口用来约束数组 type numberIndex{ [index:number]:string } const testArray:num
阅读全文

浙公网安备 33010602011771号