void

函数没有返回值

  1. function say_hello(name:string):void{
  2. console.log(`hello ${name}`)
  3. }
  4. say_hello('xiaoming');

null 与 undefined

  1. let u:undefined = undefined;
  2. let n:null = null;
  3. let n1:string | null | undefined;
  4. n1 = undefined