import { AsyncTreeVisitor, TreeVisitor } from "./visitor"; /** * A function that, when given a node, returns a map naming and identifying each * of its children. **/ export declare type NamedChildren = (n: T) => (Record & { then?: never; }) | {}; /** * A function that, when given a node, returns a promise to a map naming and * identifying each of its children. **/ export declare type NamedAsyncChildren = (n: T) => Promise<(Record & { then?: never; }) | {}>; /** * An implementation of the `TreeVisitor` interface that works for any data * structure that provides a `NamedChildren` type function. */ export declare class GenericVisitor implements TreeVisitor { /** The root node of the tree */ protected rootNode: T; /** The function that identifies children */ protected namedChildren: NamedChildren; constructor( /** The root node of the tree */ rootNode: T, /** The function that identifies children */ namedChildren: NamedChildren); get root(): T; children(n: T): T[]; } /** * An implementation of the `TreeVisitor` interface that works for any data * structure that provides a `NamedChildren` type function but needs to * make async calls to identify children. */ export declare class GenericAsyncVisitor implements AsyncTreeVisitor { /** The root node of the tree */ protected rootNode: T; /** The function that identifies children */ protected namedChildren: NamedAsyncChildren; constructor( /** The root node of the tree */ rootNode: T, /** The function that identifies children */ namedChildren: NamedAsyncChildren); get root(): T; children(n: T): Promise; }