Type alias SpreadDeepWithinObject<T, TCondition, TValue>

SpreadDeepWithinObject<T, TCondition, TValue>: {
    [K in keyof T]: SpreadDeepObject<T[K], TCondition, TValue>
}

Applies SpreadDeep to each property of an object type T with value type of object.

Typically used when the condition also applies to the outer object type, but you need to spread values within the object.

Type Parameters

  • T extends object

    The object type to spread.

  • TCondition extends Record<string, any>

    The condition type used to determine which properties to spread.

  • TValue extends Record<string, any>

    The value type used to spread the properties.

Example

type ArrayExampleCondition = {
length: number
}

type Value = {
prop1: string
}

type Data = {
length: number

inner: { a: string; length: number }
}

type NewType = SpreadDeepWithinObject<Data, ArrayExampleCondition, Value>

type NewTypeResult = {
// outer object remains unchanged
length: number
inner: {
a: string
length: number
prop1: string // <-- New property
}
}

Generated using TypeDoc