// @ts-ignore - Only used in doc comments import type { Merge } from "./Merge"; // @ts-ignore - Only used in doc comments import type MergeFn from "./Merge"; import type { Args, Fn } from "../HKT"; type _Id = { [K in keyof O]: O[K] }; /** * Simply merge two objects together without considering optional properties. * * It is recommended to use to optimize performance when you're sure that * the two objects have no optional properties, otherwise use {@link Merge}. * * Sig: `(l: object, r: object) => object` * * @example * ```typescript * type A = { a: number; b: string }; * type B = { a: boolean; c: string }; * type R = SimpleMerge; * // ^?: { a: boolean; b: string; c: string } * ``` * * @see {@link Merge} */ export type SimpleMerge = _Id<{ [K in keyof L | keyof R]: K extends keyof R ? R[K] : K extends keyof L ? L[K] : never; }>; /** * Fn] Simply merge two objects together without considering optional properties. * * It is recommended to use to optimize performance when you're sure that * the two objects have no optional properties, otherwise use {@link MergeFn}. * * Sig: `(l: object, r: object) => object` * * @see {@link MergeFn} */ export default interface SimpleMergeFn extends Fn<[object, object], object> { def: ([l, r]: Args) => SimpleMerge; }