/** An event announcing the parent of a particular node */ export interface ParentEvent { type: "parent"; parent: T; node: T; } /** An event announcing the name of a particular node. */ export interface NodeEvent { type: "node"; node: T; } /** An event announcing the names of all children associated with a given node. */ export interface ChildrenEvent { type: "children"; node: T; children: T[]; } /** The union of all possible events */ export declare type TreeEvent = ParentEvent | ChildrenEvent | NodeEvent; /** A type for functions that handle these tree events */ export declare type TreeHandler = (event: TreeEvent) => void; /** * The `TreeVisitor` interface is a very simple interface that can be * implemented to handle any data structure that can be synchronously * mapped to a tree. */ export interface TreeVisitor { root: T; children(n: T): T[]; } /** * The `AsyncTreeVisitor` interface is a very simple interface that can be * implemented to handle any data structure that can be asynchronously * mapped to a tree. */ export interface AsyncTreeVisitor { root: T; children(n: T): Promise; }