import { DecrementDepth, Depth } from "./Depth.js"; import { PrependPath } from "./PrependPath.js"; import { Obj } from "./Obj.js"; import { ArrayIndex } from "./ArrayIndex.js"; import { ShouldTerminatePathing } from "./ShouldTerminatePathing.js"; import { Path } from "./Path.js"; import { ToNumber } from "./ToNumber.js"; type IfExtends = Value extends Target ? Then : never; /** * Internal path builder that only produces paths ending in type Target. */ type BuildPathsEndingIn = ShouldTerminatePathing extends true ? never : T extends readonly unknown[] ? { [K in ArrayIndex]: IfExtends], Target, PrependPath> | BuildPathsEndingIn], Target, DecrementDepth, PrependPath>; }[ArrayIndex] : T extends Obj ? { [K in keyof T]: IfExtends> | BuildPathsEndingIn, PrependPath>; }[keyof T] : never; /** * Generates a union of all valid dot-notation paths for type T that terminate in type Target. * * @typeParam T - The object type to generate paths for * @typeParam Target - The type that paths must end in * @typeParam D - Depth tuple (default: Depth<5> = 5 levels) * * @example * type Obj = { name: string; age: number; nested: { title: string } }; * type StringPaths = PathEndingIn; // "name" | "nested.title" * type NumberPaths = PathEndingIn; // "age" */ export type PathEndingIn> = BuildPathsEndingIn & Path; export {}; //# sourceMappingURL=PathEndingIn.d.ts.map