PokéRogue
    Preparing search index...

    Type Alias Merge<Destination, Source>

    Merge: Destination extends unknown
        ? Source extends unknown
            ? If<
                IsEqual<Destination, Source>,
                Destination,
                _Merge<Destination, Source>,
            >
            : never
        : never

    Merge two types into a new type. Keys of the second type overrides keys of the first type.

    Type Parameters

    • Destination
    • Source
    import type {Merge} from 'type-fest';

    type Foo = {
    [x: string]: unknown;
    [x: number]: unknown;
    foo: string;
    bar: symbol;
    };

    type Bar = {
    [x: number]: number;
    [x: symbol]: unknown;
    bar: Date;
    baz: boolean;
    };

    export type FooBar = Merge<Foo, Bar>;
    //=> {
    // [x: string]: unknown;
    // [x: number]: number;
    // [x: symbol]: unknown;
    // foo: string;
    // bar: Date;
    // baz: boolean;
    // }

    Note: If you want a merge type that more accurately reflects the runtime behavior of object spread or Object.assign, refer to the ObjectMerge type.

    ObjectMerge