/** * ITEMS NESTED BY A PARENT ID, each drawn exactly once. A missing or self parent leaves an item at * the top; a parent loop promotes its first item and drops the closing link. */ export interface Forest { /** In the caller's order. */ roots: T[]; /** In the caller's order. */ children: (item: T) => T[]; } export declare function forest(items: readonly T[], idOf: (item: T) => string, parentOf: (item: T) => string | null | undefined): Forest;