Type alias FlattenObject<T, Delimiter>

FlattenObject<T, Delimiter>: T extends object
    ? {
        [FlatKey in Extract<FlattenKeys<T, "", Delimiter>, string>]: Get<T, Split<FlatKey, Delimiter>>
    }
    : never

Flatten an object into a single depth with the given delimiter.

Type Parameters

  • T

  • Delimiter extends string = ""

Example

type Foo = {
bar: {
baz: string
qux: number
},
quux: boolean
}
type FlatFoo = FlattenObject<Foo, '_'>
// {
// 'bar_baz': string
// 'bar_qux': number
// 'quux': boolean
// }

Generated using TypeDoc