diff --git a/docs/modules/ReadonlyNonEmptyArray.ts.md b/docs/modules/ReadonlyNonEmptyArray.ts.md index 96fb90b6c..e673db26d 100644 --- a/docs/modules/ReadonlyNonEmptyArray.ts.md +++ b/docs/modules/ReadonlyNonEmptyArray.ts.md @@ -1376,7 +1376,7 @@ Added in v2.9.0 ```ts export declare const union: ( E: Eq -) => (second: ReadonlyNonEmptyArray) => (first: ReadonlyNonEmptyArray) => ReadonlyNonEmptyArray +) => (second: readonly A[]) => (first: ReadonlyNonEmptyArray) => ReadonlyNonEmptyArray ``` Added in v2.11.0 diff --git a/src/ReadonlyNonEmptyArray.ts b/src/ReadonlyNonEmptyArray.ts index cce5f2713..87bed8e59 100644 --- a/src/ReadonlyNonEmptyArray.ts +++ b/src/ReadonlyNonEmptyArray.ts @@ -204,7 +204,7 @@ export const sortBy = ( */ export const union = ( E: Eq -): ((second: ReadonlyNonEmptyArray) => (first: ReadonlyNonEmptyArray) => ReadonlyNonEmptyArray) => { +): ((second: ReadonlyArray) => (first: ReadonlyNonEmptyArray) => ReadonlyNonEmptyArray) => { const uniqE = uniq(E) return (second) => (first) => uniqE(pipe(first, concat(second))) } diff --git a/test/ReadonlyNonEmptyArray.ts b/test/ReadonlyNonEmptyArray.ts index fad570f5e..0aa25bcf2 100644 --- a/test/ReadonlyNonEmptyArray.ts +++ b/test/ReadonlyNonEmptyArray.ts @@ -613,6 +613,11 @@ describe.concurrent('ReadonlyNonEmptyArray', () => { U.deepStrictEqual(concat([1, 2], [3, 4]), [1, 2, 3, 4]) U.deepStrictEqual(concat([1, 2], [2, 3]), [1, 2, 3]) U.deepStrictEqual(concat([1, 2], [1, 2]), [1, 2]) + + U.deepStrictEqual(_.union(N.Eq)([3, 4])([1, 2]), [1, 2, 3, 4]) + U.deepStrictEqual(pipe([1, 2], _.union(N.Eq)([3, 4])), [1, 2, 3, 4]) + U.deepStrictEqual(pipe([1, 2], _.union(N.Eq)([1, 3])), [1, 2, 3]) + U.deepStrictEqual(pipe([1, 2], _.union(N.Eq)([])), [1, 2]) }) it('matchLeft', () => {