TypeScript 数组和元组 数组 元组 数组 // const numArr = [1, 2, 3]; const numArr: number[] = [1, 2, 3]; // const arr = [1, "1", true]; const arr: (number | string | boolean)[] = [1, "1", true]; // 数组必须只有{name:string,age:number} const objArr: { name: