财产访问后的感叹号

时间:2017-11-06 21:09:53

标签: typescript

有谁知道这个感叹号的语法是什么?

https://github.com/GoogleChrome/chrome-launcher/blob/master/chrome-launcher.ts#L82

export async function launch(opts: Options = {}): Promise<LaunchedChrome> {
  opts.handleSIGINT = defaults(opts.handleSIGINT, true);

  const instance = new Launcher(opts);

  // Kill spawned Chrome process in case of ctrl-C.
  if (opts.handleSIGINT && instances.size === 0) {
    process.on(_SIGINT, sigintListener);
  }
  instances.add(instance);

  await instance.launch();

  const kill = async () => {
    instances.delete(instance);
    if (instances.size === 0) {
      process.removeListener(_SIGINT, sigintListener);
    }
    return instance.kill();
  };

  return {pid: instance.pid!, port: instance.port!, kill, chromeProcess: instance.chrome};   // here!
}

是什么

pid: instance.pid!

意思?

0 个答案:

没有答案