import { S as Substract } from './chunks/CM89_aaq.js'; import { p as IsZero } from './chunks/DZEfmVOc.js'; import './BooleanNor.js'; import './BooleanNot.js'; import './BooleanOr.js'; import './Tuple.js'; import './BooleanAnd.js'; import './MaybeReadonly.js'; import './TupleLength.js'; /** * Extract all of the nested keys of an object. The keys are returned as a * string literal union. This is useful for creating a type that can be used to * access nested properties of an object allowing comprehensive autocompletion * and type checking. * * @template T Object type to extract keys from. * @template N Number of nested keys to explore before returning a loose path. * @template P Current path to prepend to the keys. Used internally for recursion. * @returns List of possible paths. * @example * interface Contact { * name: { first: string; last: string } * email: string * } * * type Result = Path // 'name' | 'name.first' | 'name.last' | 'email' */ type Path = T extends object ? IsZero extends true ? P extends `${infer P1}.` ? P1 : P : T extends Array ? U extends object ? Path, `${P}${number}.`> : (P extends '' ? `${number}` : `${P}${number}`) : Extract<{ [K in keyof T]-?: K extends number | string ? (P extends '' ? `${K}` : `${P}${K}`) | (T[K] extends object ? Path, `${P}${K}.`> : `${P}${K}`) : never; }[keyof T], string> : never; export type { Path };