TS语法1

178 阅读1分钟

数组类型

let list:number[] = [1,2,3]

联合类型

// 竖线就叫联合类型
let list:(number | string)[] = [1,2,3,'a']