src/language-js/parser-typescript.js/parse
function parse(text, parsers, opts) {
  const jsx = isProbablyJsx(text);
  let ast;
  try {
    // Try passing with our best guess first.
    ast = tryParseTypeScript(text, jsx);
  } catch (firstError) {
    try {
      // But if we get it wrong, try the opposite.
      ast = tryParseTypeScript(text, !jsx);
    } catch (secondError) {
      // suppose our guess is correct
      const e = firstError;

      if (typeof e.lineNumber === "undefined") {
        throw e;
      }

      throw createError(e.message, {
        start: { line: e.lineNumber, column: e.column + 1 },
      });
    }
  }

  return postprocess(ast, { ...opts, originalText: text });
}