Ramda: Enable return type polymorphism for min/max

This commit is contained in:
Jonas Schürmann
2017-10-31 13:19:46 +01:00
parent 5baaeafba9
commit e26351b49f
2 changed files with 8 additions and 8 deletions

View File

@@ -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

View File

@@ -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'
};
() => {