TypeScript$Type-Value-BasicTypes
JavaScript 中的基本类型在 TypeScript 中也一样,其中 null 和 undefined 值得注意:
stringnumberbooleannull/undefined- 当配置项
strictNullChecks为false时,和 JavaScript 没有区别;当为true时,会对null/undefined的值做限定:如不允许获取属性等操作(null和undefined获取属性会报错) - postfix
!(non-null assertion operator):console.log(x!.toFixed()); // 在变量后面加! 表示我们知道该值不为 null / undefined
- 当配置项
bigintsymbol