mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-07-01 07:40:10 +00:00
Support infinitary functions in cond type type def
This commit is contained in:
3
types/ramda/index.d.ts
vendored
3
types/ramda/index.d.ts
vendored
@@ -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<A, B>(fns: ReadonlyArray<[SafePred<A>, (a: A) => B]>): (a: A) => B;
|
||||
cond(fns: ReadonlyArray<[Pred, (...a: any[]) => any]>): (...a: any[]) => any;
|
||||
cond<A, B>(fns: ReadonlyArray<[SafePred<A>, (...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.
|
||||
|
||||
@@ -1312,13 +1312,15 @@ type Pair = KeyValuePair<string, number>;
|
||||
]);
|
||||
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, "");
|
||||
};
|
||||
|
||||
() => {
|
||||
|
||||
Reference in New Issue
Block a user