1.字符串类型:
2.数组类型:
let b:number[] = [1,2,3]或者let b:Array
3.元组类型:
let arr: [string, number, boolean] = [“a”, 1, false];
4.枚举类型:
enum Flag {
success = 1,
error = 2,
}
let f: Flag = Flag.success;
console.log(f); //1
enum Color {
red,
blue = 5,
orange,
} //如果不负值,默认是索引值
let c: Color = Color.red;
let d: Color = Color.blue;
console.log(c,d);