image.png

1.字符串类型:

let a:string = ‘aaa’;

2.数组类型:

let b:number[] = [1,2,3]或者let b:Array = [1,2,3]

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);

5.undefined:

image.png

6.void类型

image.png
image.png
image.png

7.never类型

image.png