export type User = { id: string; name: string; managerId?: string; email?: string };export class ChainError extends Error { constructor( public readonly kind: "unknown_user" | "cycle", public readonly id: string, ) { super(`${kind}: ${id}`); }}/** The first non-empty email up the chain, or undefined if there is none. Throws ChainError. */export function escalationEmail(users: readonly User[], userId: string): string | undefined { // TODO}