@oazmi/kitchensink - v0.9.13
    Preparing search index...

    Type Alias DeepPartial<T>

    DeepPartial: T extends | Function
    | any[]
    | Set<any>
    | Map<any, any>
    | WeakSet<any>
    | WeakMap<any, any>
    | TypedArray
    | URL
    | String
    | BigInt
    | Number
    | Boolean
    | Symbol
        ? T
        : T extends Record<string, any>
            ? { [P in keyof T]?: DeepPartial<T[P]> }
            : T

    turn all fields of an object T to optional, deeply.

    Note

    we exclude many built-in types and classes so that they are not turned into partial types. here is the full list of built-in types and classes (aside from primitives) that are not turned into partial objects:

    Function | Array<any> | Set<any> | Map<any, any> | WeakSet<any> | WeakMap<any, any> | TypedArray | URL | String | BigInt | Number | Boolean | Symbol

    Type Parameters

    • T
    const my_obj = {
    a: 1,
    b: { c: 2 },
    d: { e: { f: 3 }, g: 4 },
    h: { i: [{ j: 5 }, { k: 6 }] },
    l: { m: ((arg: string) => "hello") },
    n: new URL("https://example.com"),
    o: new Map<string, number>([["a", 1], ["b", 2]]),
    } as const

    type DeeplyPartial_my_obj = DeepPartial<typeof my_obj>
    type ManuallyConstructed_DeeplyPartial_my_obj = {
    a?: 1,
    b?: { c?: 2 },
    d?: { e?: { f?: 3 }, g?: 4 },
    h?: { i?: readonly [_0?: { j?: 5 } | undefined, _1?: { k?: 6 } | undefined] },
    l?: { m?: ((arg: string) => string) },
    n?: URL,
    o?: Map<string, number>,
    }

    type BothTypesAreEqual_1 = DeeplyPartial_my_obj extends ManuallyConstructed_DeeplyPartial_my_obj ? true : false
    type BothTypesAreEqual_2 = ManuallyConstructed_DeeplyPartial_my_obj extends DeeplyPartial_my_obj ? true : false

    const temp: true = true
    temp satisfies BothTypesAreEqual_1
    temp satisfies BothTypesAreEqual_2