From 2052b214bc69e0659d3b8700a602c506491ed026 Mon Sep 17 00:00:00 2001 From: Pawel Paradysz Date: Thu, 21 Mar 2024 16:52:33 +0000 Subject: [PATCH 1/2] Update Array.ts It makes the difference signature match that of Set. It makes it explicit that curried and uncurried versions have flipped order of arguments. --- src/Array.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Array.ts b/src/Array.ts index d49925c41..ccf6fc866 100644 --- a/src/Array.ts +++ b/src/Array.ts @@ -1409,17 +1409,17 @@ export function intersection(E: Eq): (xs: Array, ys?: Array) => Arra * @since 2.0.0 */ export function difference(E: Eq): { - (xs: Array): (ys: Array) => Array - (xs: Array, ys: Array): Array + (that: Array): (me: Array) => Array + (me: Array, that: Array): Array } -export function difference(E: Eq): (xs: Array, ys?: Array) => Array | ((ys: Array) => Array) { +export function difference(E: Eq): (me: Array, that?: Array) => Array | ((me: Array) => Array) { const elemE = elem(E) - return (xs, ys?) => { - if (ys === undefined) { + return (me, that?) => { + if (that === undefined) { const differenceE = difference(E) - return (ys) => differenceE(ys, xs) + return (that) => differenceE(that, me) } - return xs.filter((a) => !elemE(a, ys)) + return me.filter((a) => !elemE(a, that)) } } From 2eb153a8814f3c737dbcc972ab18221086c484aa Mon Sep 17 00:00:00 2001 From: Pawel Paradysz Date: Thu, 21 Mar 2024 19:08:11 +0100 Subject: [PATCH 2/2] dtslint update --- dtslint/ts3.5/Array.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dtslint/ts3.5/Array.ts b/dtslint/ts3.5/Array.ts index 3d2850922..1b0af8e52 100644 --- a/dtslint/ts3.5/Array.ts +++ b/dtslint/ts3.5/Array.ts @@ -67,7 +67,7 @@ _.elem(N.Eq)(1) // $ExpectType (as: number[]) => boolean // _.difference(N.Eq)([1, 2], [3, 4]) // $ExpectType number[] -_.difference(N.Eq)([3, 4]) // $ExpectType (ys: number[]) => number[] +_.difference(N.Eq)([3, 4]) // $ExpectType (me: number[]) => number[] // // intersection