Type alias NestedReplace<T, TPath, TValue>

NestedReplace<T, TPath, TValue>: TPath extends keyof T
    ? {
        [K in keyof T]: K extends TPath
            ? TValue
            : T[K]
    }
    : TPath extends `${infer Head}.${infer Tail}`
        ? Head extends keyof T
            ? {
                [K in keyof T]: K extends Head
                    ? NestedReplace<T[K], Tail extends Paths<T[K]>
                        ? Tail
                        : never, TValue>
                    : T[K]
            }
            : never
        : never

Replaces the value at the specified path in the object type T with the provided value.

Type Parameters

  • T

    The object type.

  • TPath extends Paths<T>

    The path to the value to be replaced.

  • TValue

    The type of the value to replace with.

Generated using TypeDoc