UNPKG

merge-change

Version:

Advanced library for deep merging, patching, and immutable updates of data structures. Features declarative operations for specific merging behaviors, property management, custom type merging rules, and difference tracking. Supports complex data transform

10 lines (9 loc) 510 B
import { ExtractPathsLeaf, PathToType } from '../common-types/types'; /** * Creates a type representing a flattened object where all nested properties are at the top level. * Property names are dot-notation paths to the original nested properties. * For example, PlainObject<{a: {b: number}}> => {a: {b: number}, "a.b": number} */ export type FlatObject<T, Sep extends string = '.', Prefix extends string = ''> = { [K in ExtractPathsLeaf<T, Sep> & string as `${Prefix}${K}`]: PathToType<T, K, Sep>; };