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

    Type Alias DeepRequired<T>

    DeepRequired: 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]-?: DeepRequired<T[P]> }
            : T

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

    Note

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

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

    Type Parameters

    • T
    type MyType = {
    a?: 1,
    b: { c?: 2 },
    d: { e?: { f: 3 }, g?: 4 },
    h: { i?: [_0?: { j?: 5 } | undefined, _1?: { k?: 6 } | undefined] },
    l?: { m?: ((arg: string) => string), n: 7 | undefined, o?: 8 | undefined },
    }

    type MyType_DeeplyRequired = DeepRequired<MyType>

    type ManuallyConstructed_MyType_DeeplyRequired = DeepRequired<{
    a: 1,
    b: { c: 2 },
    d: { e: { f: 3 }, g: 4 },
    h: { i: [_0?: { j?: 5 } | undefined, _1?: { k?: 6 } | undefined] },
    l: { m: ((arg: string) => string), n: 7 | undefined, o: 8 },
    }>

    type BothTypesAreEqual_1 = MyType_DeeplyRequired extends ManuallyConstructed_MyType_DeeplyRequired ? true : false
    type BothTypesAreEqual_2 = ManuallyConstructed_MyType_DeeplyRequired extends MyType_DeeplyRequired ? true : false

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