mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-06-06 06:19:58 +08:00
[ramda] Add second type argument to eqBy to allow different codomain (#23926)
* Add second type argument to eqBy to allow different codomain * Add test for new type argument * Resolve unreachable function overload
This commit is contained in:
7
types/ramda/index.d.ts
vendored
7
types/ramda/index.d.ts
vendored
@@ -576,10 +576,9 @@ declare namespace R {
|
||||
* Takes a function and two values in its domain and returns true if the values map to the same value in the
|
||||
* codomain; false otherwise.
|
||||
*/
|
||||
eqBy<T>(fn: (a: T) => T, a: T, b: T): boolean;
|
||||
eqBy<T>(fn: (a: T) => T, a: T): (b: T) => boolean;
|
||||
eqBy<T>(fn: (a: T) => T): (a: T, b: T) => boolean;
|
||||
eqBy<T>(fn: (a: T) => T): (a: T) => (b: T) => boolean;
|
||||
eqBy<T, U = T>(fn: (a: T) => U, a: T, b: T): boolean;
|
||||
eqBy<T, U = T>(fn: (a: T) => U, a: T): (b: T) => boolean;
|
||||
eqBy<T, U = T>(fn: (a: T) => U): CurriedFunction2<T, T, boolean>;
|
||||
|
||||
/**
|
||||
* Reports whether two functions have the same value for the specified property.
|
||||
|
||||
@@ -2136,6 +2136,14 @@ class Rectangle {
|
||||
const c: (a: any[]) => any[] = R.symmetricDifferenceWith(eqA)(l1); // => [{a: 1}, {a: 2}, {a: 5}, {a: 6}]
|
||||
};
|
||||
|
||||
() => {
|
||||
const eqL = R.eqBy<string, number>(s => s.length);
|
||||
const l1 = ['bb', 'ccc', 'dddd'];
|
||||
const l2 = ['aaa', 'bb', 'c'];
|
||||
R.symmetricDifferenceWith(eqL, l1, l2); // => ['dddd', 'c']
|
||||
R.symmetricDifferenceWith(eqL)(l1, l2); // => ['dddd', 'c']
|
||||
};
|
||||
|
||||
/*****************************************************************
|
||||
* String category
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user