src/language-js/parse/typescript.js/parse
function parse(text, parsers, options = {}) {
  const textToParse = replaceHashbang(text);
  const jsx = isProbablyJsx(text);

  const { parseWithNodeMaps } = require("@typescript-eslint/typescript-estree");
  const { result, error: firstError } = tryCombinations(
    // Try passing with our best guess first.
    () => parseWithNodeMaps(textToParse, { ...parseOptions, jsx }),
    // But if we get it wrong, try the opposite.
    () => parseWithNodeMaps(textToParse, { ...parseOptions, jsx: !jsx })
  );

  if (!result) {
    // Suppose our guess is correct, throw the first error
    throw createParseError(firstError);
  }

  options.originalText = text;
  options.tsParseResult = result;
  return postprocess(result.ast, options);
}