import type { Record } from "effect"; import type * as GroupSpec from "./GroupSpec"; /** * Recursively generates paths for a group and its nested groups. * * - For a group with no subgroups, returns just the group name. * - For a group with subgroups, returns the group name plus all possible paths through its direct subgroups. */ export type All = Depth["length"] extends 15 ? string : Group extends any ? [GroupSpec.Groups] extends [never] ? GroupSpec.Name : GroupSpec.Name | AllHelper, Depth> : never; type AllHelper = Groups_ extends GroupSpec.AnyWithProps ? `${GroupSpec.Name}.${All}` : never; /** * Recursively extracts the group at the given dot-separated path. * Path must match the format defined in `Path` above, e.g. "group" or "group.subgroup". * * @example * ```ts * type G = WithPath; * ``` */ export type GroupAt = Group extends GroupSpec.AnyWithProps ? Path extends `${infer Head}.${infer Tail}` ? Group extends { readonly name: Head; } ? Group extends { readonly groups: Record.ReadonlyRecord; } ? GroupAt : never : never : GroupSpec.WithName : never; export type SubGroupsAt = GroupSpec.Groups> extends infer SubGroups ? SubGroups extends GroupSpec.AnyWithProps ? `${GroupPath}.${GroupSpec.Name}` : never : never; export {}; //# sourceMappingURL=GroupPath.d.ts.map