From 99658451404bd2558817acfa469500632120ffbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miika=20H=C3=A4nninen?= Date: Tue, 12 Mar 2019 10:08:36 +0200 Subject: [PATCH] (ramda) Fix traverse types in the all-arrays case The traverse function is not properly typeable at this moment since we lack higher-kinded types. Specific cases are doable though, like the array-array case I've typed here. Users can add their own specific cases in their own typings, to extend this. --- types/ramda/index.d.ts | 6 +++--- types/ramda/ramda-tests.ts | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/types/ramda/index.d.ts b/types/ramda/index.d.ts index 917715c3e7..1078d9a51a 100644 --- a/types/ramda/index.d.ts +++ b/types/ramda/index.d.ts @@ -2686,9 +2686,9 @@ declare namespace R { * sequence to transform the resulting Traversable of Applicative into * an Applicative of Traversable. */ - traverse(of: (a: U[]) => A, fn: (t: T) => U, list: ReadonlyArray): A; - traverse(of: (a: U[]) => A, fn: (t: T) => U): (list: ReadonlyArray) => A; - traverse(of: (a: U[]) => A): (fn: (t: T) => U, list: ReadonlyArray) => A; + traverse(of: (a: B) => ReadonlyArray, fn: (t: A) => ReadonlyArray, list: ReadonlyArray): B[][]; + traverse(of: (a: B) => ReadonlyArray, fn: (t: A) => ReadonlyArray): (list: ReadonlyArray) => B[][]; + traverse(of: (a: B) => ReadonlyArray): (fn: (t: A) => ReadonlyArray, list: ReadonlyArray) => B[][]; /** * Removes (strips) whitespace from both ends of the string. diff --git a/types/ramda/ramda-tests.ts b/types/ramda/ramda-tests.ts index 2d8b00ba6a..6f88d82200 100644 --- a/types/ramda/ramda-tests.ts +++ b/types/ramda/ramda-tests.ts @@ -1460,7 +1460,7 @@ type Pair = KeyValuePair; const list = [1, 2, 3]; R.traverse(of, fn, list); R.traverse(of, fn)(list); - R.traverse(of)(fn, list); + R.traverse(of)(fn, list); }; () => {