function keysFromParser(parserPath, parserInstance, parsedResult) {
  // Exposed by @typescript-eslint/parser and @babel/eslint-parser
  if (parsedResult && parsedResult.visitorKeys) {
    return parsedResult.visitorKeys;
  }
  // The old babel parser doesn't have a `parseForESLint` eslint function, so we don't end
  // up with a `parsedResult` here.  It also doesn't expose the visitor keys on the parser itself,
  // so we have to try and infer the visitor-keys module from the parserPath.
  // This is NOT supported in flat config!
  if (typeof parserPath === 'string' && parserPath.indexOf('babel-eslint') > -1) {
    return getBabelEslintVisitorKeys(parserPath);
  }
  // The espree parser doesn't have the `parseForESLint` function, so we don't end up with a
  // `parsedResult` here, but it does expose the visitor keys on the parser instance that we can use.
  if (parserInstance && parserInstance.VisitorKeys) {
    return parserInstance.VisitorKeys;
  }
  return null;
}
@type {(parserPath: import('eslint').Rule.RuleContext['parserPath'], parserInstance: { VisitorKeys: unknown }, parsedResult?: { visitorKeys?: unknown }) => unknown}