Vertex Viewer SDK
    Preparing search index...

    Type Alias DeepRequired<T, P>

    DeepRequired: T extends unknown[]
        ? T
        : T extends Record<string, unknown>
            ? Pick<T, Extract<keyof T, P[0]>> & Required<
                {
                    [K in Exclude<keyof T, P[0]>]: NonNullable<
                        DeepRequired<T[K], ShiftUnion<K, P>>,
                    >
                },
            >
            : T

    A type that recursively makes each property of T required. Optionally excluding a nested path specified by a list of keys.

    Type Parameters

    • T
    • P extends string[]
    type Foo = { a?: { c?: number }, b?: string };
    type Bar = { foo: Foo };
    type Baz = DeepRequired<Bar, []>; // { foo: { a: { c: number }, b: string } }
    type Baz = DeepRequired<Bar, ['a', 'c']>; // { foo: { a: { c?: number }, b: string } }
    type Baz = DeepRequired<Bar, ['a'] | ['b']>; // { foo: { a: { c?: number }, b?: string } }