From 8cfbfbf4be20e8dfe1288d1cf5d7879815882e4e Mon Sep 17 00:00:00 2001 From: Alex Deas Date: Thu, 6 Dec 2018 22:10:03 +0000 Subject: [PATCH] Support infinitary functions in cond type type def --- types/ramda/index.d.ts | 3 ++- types/ramda/ramda-tests.ts | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/types/ramda/index.d.ts b/types/ramda/index.d.ts index 77dcdb05a0..48888c6ee5 100644 --- a/types/ramda/index.d.ts +++ b/types/ramda/index.d.ts @@ -776,7 +776,8 @@ declare namespace R { * point fn returns the result of applying its arguments to the corresponding transformer. If none of the predicates * matches, fn returns undefined. */ - cond(fns: ReadonlyArray<[SafePred, (a: A) => B]>): (a: A) => B; + cond(fns: ReadonlyArray<[Pred, (...a: any[]) => any]>): (...a: any[]) => any; + cond(fns: ReadonlyArray<[SafePred, (...a: A[]) => B]>): (...a: A[]) => B; /** * Wraps a constructor function inside a curried function that can be called with the same arguments and returns the same type. diff --git a/types/ramda/ramda-tests.ts b/types/ramda/ramda-tests.ts index 61f09c1f40..2bd9a55d2f 100644 --- a/types/ramda/ramda-tests.ts +++ b/types/ramda/ramda-tests.ts @@ -1312,13 +1312,15 @@ type Pair = KeyValuePair; ]); f(0); // $ExpectType string f(""); // $ExpectError + f(1, 2); // $ExpectType string const g = R.cond([ - [x => x === 0, () => "a"], + [(a, b) => a === b, () => "a"], [() => true, () => "b"], ]); g(0); g(""); + g(1, ""); }; () => {