string | 字符串 |
---|---|
number | 数值 NaN Infinity |
boolean | true / false |
void | undefined |
null | null |
undefined | undefined |
symbol | Symbol() |
默认模式下可以为 null
const a: string = 'string';
const b: number = 1;
const c: boolean = false;
const d: void = undefined;
const e: null = null;
const f: undefined = undefined;
const g: symbol = Symbol();