//#region src/array/array-union.d.ts /** * Returns the union of two arrays — all unique elements from both `firstArray` * and `secondArray`, preserving order of first appearance. The strategy used * for the equality check depends on the optional third argument: * * - When omitted, items are compared using `SameValueZero` (the same semantics * as `Set.prototype.has`). * - When a binary function `(a, b) => boolean` is passed, it is used as a * custom comparator (delegates to `unionWith`). * - When a unary function `(value) => key` is passed, both arrays are mapped * through it and the resulting keys are compared (delegates to `unionBy`). * @param firstArray - The first array. Not mutated. * @param secondArray - The second array. Not mutated. * @returns A new array containing all unique elements from both arrays. * @example * // Basic equality (SameValueZero) * arrayUnion([1, 2, 3], [3, 4, 5]); * // [1, 2, 3, 4, 5] * @example * // With a mapper — compare by a derived key * arrayUnion( * [{id: 1}, {id: 2}], * [{id: 2}, {id: 3}], * (item) => item.id, * ); * // [{id: 1}, {id: 2}, {id: 3}] * @example * // With a custom comparator * arrayUnion( * [{id: 1}, {id: 2}], * [{id: 2}, {id: 3}], * (a, b) => a.id === b.id, * ); * // [{id: 1}, {id: 2}, {id: 3}] */ declare function arrayUnion(firstArray: readonly T[], secondArray: readonly T[]): T[]; declare function arrayUnion(firstArray: readonly T[], secondArray: readonly T[], areItemsEqual: (x: T, y: T) => boolean): T[]; declare function arrayUnion(firstArray: readonly T[], secondArray: readonly T[], mapper: (value: T) => unknown): T[]; //#endregion export { arrayUnion };