From 1066f6fb8280aa7bc0553c27ca76739b4666c6bb Mon Sep 17 00:00:00 2001 From: Cort Spellman Date: Sun, 24 Sep 2017 01:39:09 -0500 Subject: [PATCH] [ramda]: Correct order of reducing-fn params in reduceRight (#18798) The reducing function in Ramda's reduceRight has signature (elem: T, acc: TResult) => TResult, as per https://github.com/ramda/ramda/blob/v0.24.0/src/reduceRight.js. The order of the parameters was switched at https://github.com/ramda/ramda/commit/68d1dc19fb035b0fcafcc1857331f9d00986470f --- types/ramda/index.d.ts | 6 +++--- types/ramda/ramda-tests.ts | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/types/ramda/index.d.ts b/types/ramda/index.d.ts index ab132df060..c538d555a0 100644 --- a/types/ramda/index.d.ts +++ b/types/ramda/index.d.ts @@ -1525,9 +1525,9 @@ declare namespace R { * function and passing it an accumulator value and the current value from the array, and * then passing the result to the next call. */ - reduceRight(fn: (acc: TResult, elem: T) => TResult, acc: TResult, list: T[]): TResult; - reduceRight(fn: (acc: TResult, elem: T) => TResult): (acc: TResult, list: T[]) => TResult; - reduceRight(fn: (acc: TResult, elem: T) => TResult, acc: TResult): (list: T[]) => TResult; + reduceRight(fn: (elem: T, acc: TResult) => TResult, acc: TResult, list: T[]): TResult; + reduceRight(fn: (elem: T, acc: TResult) => TResult): (acc: TResult, list: T[]) => TResult; + reduceRight(fn: (elem: T, acc: TResult) => TResult, acc: TResult): (list: T[]) => TResult; /** * Similar to `filter`, except that it keeps only values for which the given predicate diff --git a/types/ramda/ramda-tests.ts b/types/ramda/ramda-tests.ts index 5d8dc09005..0998930d42 100644 --- a/types/ramda/ramda-tests.ts +++ b/types/ramda/ramda-tests.ts @@ -328,7 +328,7 @@ R.times(i, 5); (() => { const pairs = [["a", 1], ["b", 2], ["c", 3]]; - function flattenPairs(acc: [string, number], pair: [string, number]) { + function flattenPairs(pair: [string, number], acc: Array): Array { return acc.concat(pair); } @@ -911,7 +911,7 @@ type Pair = KeyValuePair; () => { const pairs: Pair[] = [["a", 1], ["b", 2], ["c", 3]]; - function flattenPairs(acc: Pair[], pair: Pair): Pair[] { + function flattenPairs(pair: Pair, acc: Array): Array { return acc.concat(pair); }