function tryCreateLanguageService(
  config: TSValidatorConfig,
  asset: Asset,
  options: PluginOptions,
): void {
  if (config.tsconfig && !langServiceCache[config.configHash]) {
    // In order to prevent race conditions where we accidentally create two language services for the same config,
    // we need to re-check the cache to see if a service has been created while we were awaiting 'ts'.
    if (!langServiceCache[config.configHash]) {
      let configHost = new ParseConfigHost(options.inputFS, ts);
      let parsedCommandLine = ts.parseJsonConfigFileContent(
        config.tsconfig,
        configHost,
        config.baseDir,
      );
      const host = new LanguageServiceHost(
        options.inputFS,
        ts,
        parsedCommandLine,
      );
      langServiceCache[config.configHash] = {
        configHost,
        host,
        // $FlowFixMe[incompatible-variance]
        // $FlowFixMe[incompatible-call]
        service: ts.createLanguageService(host, ts.createDocumentRegistry()),
      };
    }
  }
}
Tries to create a typescript language service instance in the cache if it doesn't already exist.