devtypes - v2.0.0
    Preparing search index...

    Type Alias DeepMergeStrict<Left, Right>

    DeepMergeStrict: Simplify<
        Left extends (infer U)[]
            ? DeepMergeStrict<U, Right>[]
            : Left extends ReadonlyArray<infer U>
                ? ReadonlyArray<DeepMergeStrict<U, Right>>
                : Left extends object
                    ? Right extends object
                        ? {
                            [K in keyof Left]: K extends keyof Right
                                ? DeepMergeStrict<Left[K], Right[K]>
                                : DeepMergeStrict<Left[K], Right>
                        } & { [K in Exclude<keyof Right, keyof Left>]: Right[K] }
                        : Left
                    : Left,
    >

    Strict deep merge of two object types.

    Type Parameters

    • Left

      Base object type

    • Right

      Overriding object type

    Similar to DeepMerge but preserves array types from the left-hand side by injecting right-hand properties into array element types.

    type A = { a: { x: { foo: true } } };
    type B = { a: { x: { foo: number, bar: string } } };
    type Merged = DeepMergeStrict< A, B >;
    // { a: { x: { foo: true, bar: string } } }