import type { Maybe } from '@dereekb/util'; import { type AstNode } from './util'; import { type ImportedBindingResolver } from './storagefile-path-fold'; /** * The slice of `@typescript-eslint` parser services the cross-module resolver needs: the TS * `Program` and the ESTree→TS node map. Typed loosely so the resolver stays decoupled from a * specific `@typescript-eslint` version. */ export interface ParserServicesLike { readonly program?: { getTypeChecker(): unknown; }; readonly esTreeNodeToTSNodeMap?: { get(node: AstNode): unknown; }; } /** * Builds an {@link ImportedBindingResolver} backed by the TypeScript type checker, or null when * type information is unavailable (e.g. a lint config without `parserOptions.project`, or a * pure-AST test harness). The resolver performs a single hop: it maps an imported identifier in * the linted file to the declaration's source file, re-parses that file to ESTree (cached), and * returns the named binding plus that module's scope. Identifiers local to the resolved module * fold via the re-parsed program directly; transitive re-imports from a third module are not * followed. * * Every failure mode (no symbol, unreadable file, parse error, identifier from an already * re-parsed module) returns null so the analyzer falls back to reporting an unresolvable path — * it never throws into the lint pass. * * @param services - The parser services, when present. * @returns A resolver, or null when type information is unavailable. */ export declare function createImportedBindingResolver(services: Maybe): Maybe;