mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-28 16:45:10 +08:00
Ramda: Enable return type polymorphism for min/max
This commit is contained in:
8
types/ramda/index.d.ts
vendored
8
types/ramda/index.d.ts
vendored
@@ -974,8 +974,8 @@ declare namespace R {
|
||||
/**
|
||||
* Returns the larger of its two arguments.
|
||||
*/
|
||||
max(a: Ord, b: Ord): Ord;
|
||||
max(a: Ord): (b: Ord) => Ord;
|
||||
max<T extends Ord>(a: T, b: T): T;
|
||||
max<T extends Ord>(a: T): (b: T) => T;
|
||||
|
||||
/**
|
||||
* Takes a function and two values, and returns whichever value produces
|
||||
@@ -1077,8 +1077,8 @@ declare namespace R {
|
||||
/**
|
||||
* Returns the smaller of its two arguments.
|
||||
*/
|
||||
min(a: Ord, b: Ord): Ord;
|
||||
min(a: Ord): (b: Ord) => Ord;
|
||||
min<T extends Ord>(a: T, b: T): T;
|
||||
min<T extends Ord>(a: T): (b: T) => T;
|
||||
|
||||
/**
|
||||
* Takes a function and two values, and returns whichever value produces
|
||||
|
||||
@@ -1982,8 +1982,8 @@ class Rectangle {
|
||||
};
|
||||
|
||||
() => {
|
||||
const x: R.Ord = R.max(7, 3); // => 7
|
||||
const y: R.Ord = R.max("a", "z"); // => 'z'
|
||||
const x: number = R.max(7, 3); // => 7
|
||||
const y: string = R.max("a", "z"); // => 'z'
|
||||
};
|
||||
|
||||
() => {
|
||||
@@ -2013,8 +2013,8 @@ class Rectangle {
|
||||
};
|
||||
|
||||
() => {
|
||||
const x: R.Ord = R.min(9, 3); // => 3
|
||||
const y: R.Ord = R.min("a", "z"); // => 'a'
|
||||
const x: number = R.min(9, 3); // => 3
|
||||
const y: string = R.min("a", "z"); // => 'a'
|
||||
};
|
||||
|
||||
() => {
|
||||
|
||||
Reference in New Issue
Block a user