import type { UnionToIntersection } from './types.js'; type Split = string extends T ? [T] : T extends `${infer H}${S}${infer R}` ? [H, ...Split] : [T]; type TupleOf = T['length'] extends N ? T : TupleOf; type Add = [...A, ...B]; type IsAtDepth = L extends [...TupleOf, ...unknown[]] ? true : false; type Simplify = T extends (...args: unknown[]) => unknown ? T : T extends object ? { [K in keyof T]: Simplify; } : T; type PathObject

= P extends readonly [infer H extends string, ...infer R extends string[]] ? { [K in H]: R extends [] ? V : PathObject; } : V; interface DeflatOpenTree { [key: string]: V | DeflatOpenTree; } type DeflatOpenRecord, D extends number, L extends unknown[]> = IsAtDepth extends true ? DeflatOpenTree> : Record>; type DeflatValue = T extends Record ? string extends keyof T ? DeflatOpenRecord : DeflatAt : T; type DeflatEntry = IsAtDepth extends true ? PathObject, DeflatValue['length']>>>> : { [P in K]: DeflatValue; }; type DeflatAt, D extends number, L extends unknown[]> = Simplify; }[keyof T & string]>>; export type Deflat, D extends number = 0> = string extends keyof T ? DeflatOpenRecord : DeflatAt; export type DeflatFromDepth> = Simplify<{ [K in keyof T]: DeflatValue; }>; /** * Deflates dotted object keys into nested objects. * @param input - Object with dotted keys. * @param depth - Nesting level where dotted keys should start being deflated. * @returns Nested object built from dotted keys. */ export declare function deflat>(input: T): Deflat; /** * Deflates dotted object keys into nested objects starting from a depth. * @param input - Object with dotted keys. * @param depth - Nesting level where dotted keys should start being deflated. * @returns Nested object built from dotted keys. */ export declare function deflat, const D extends number>(input: T, depth: D): Deflat; /** * Deflates dotted object keys into nested objects starting from a depth. * @param input - Object with dotted keys. * @param depth - Nesting level where dotted keys should start being deflated. * @returns Nested object built from dotted keys. */ export declare function deflat>(input: T, depth: number): DeflatFromDepth; export {}; //# sourceMappingURL=deflat.d.ts.map