数组类型的定义
const numberArry :number[] = [1,2,3];
const stringArry :string[]=['a','b'];
const undefinedArry :undefined[] =[undefined,undefined];
const arr :(number | string)[]=[1,2,'abc'];
const xiaojiejieps :[string,string,number][] = [
['da','daa',1],
['cc','ccc',3],
['dfsa','dsaf',4]
]
const xiaojiejie :{name:string,age:number}[]=[
{name:'xiaohong',age:11},
{name:'xiaolan',age:122}
]
tpye Lady ={name:string,age:number};
const xiaojiejie :Lady[]=[
{name:'xiaohong',age:11},
{name:'xiaolan',age:122}
]
class Madam {
name: string;
age: number;
}
const xiaoJieJies: Madam[] = [
{ name: "刘英", age: 18 },
{ name: "谢大脚", age: 28 },
];