mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
lodash: Consider rest operator for intersectionBy (#36610)
This commit is contained in:
parent
1d1a9e75db
commit
a64e763292
21
types/lodash/common/array.d.ts
vendored
21
types/lodash/common/array.d.ts
vendored
@ -1205,6 +1205,11 @@ declare module "../index" {
|
||||
array?: List<T> | null,
|
||||
...values: Array<List<T>>
|
||||
): T[];
|
||||
|
||||
/**
|
||||
* @see _.intersectionBy
|
||||
*/
|
||||
intersectionBy<T>(...values: Array<List<T> | ValueIteratee<T>>): T[];
|
||||
}
|
||||
|
||||
interface LoDashImplicitWrapper<TValue> {
|
||||
@ -1240,10 +1245,10 @@ declare module "../index" {
|
||||
/**
|
||||
* @see _.intersectionBy
|
||||
*/
|
||||
intersectionBy<T>(
|
||||
this: LoDashImplicitWrapper<List<T> | null | undefined>,
|
||||
...values: Array<List<T>>
|
||||
): LoDashImplicitWrapper<T[]>;
|
||||
intersectionBy<T1, T2>(
|
||||
this: LoDashImplicitWrapper<List<T1> | null | undefined>,
|
||||
...values: Array<List<T2> | ValueIteratee<T1 | T2>>
|
||||
): LoDashImplicitWrapper<T1[]>;
|
||||
}
|
||||
|
||||
interface LoDashExplicitWrapper<TValue> {
|
||||
@ -1279,10 +1284,10 @@ declare module "../index" {
|
||||
/**
|
||||
* @see _.intersectionBy
|
||||
*/
|
||||
intersectionBy<T>(
|
||||
this: LoDashExplicitWrapper<List<T> | null | undefined>,
|
||||
...values: Array<List<T>>
|
||||
): LoDashExplicitWrapper<T[]>;
|
||||
intersectionBy<T1, T2>(
|
||||
this: LoDashExplicitWrapper<List<T1> | null | undefined>,
|
||||
...values: Array<List<T2> | ValueIteratee<T1 | T2>>
|
||||
): LoDashExplicitWrapper<T1[]>;
|
||||
}
|
||||
|
||||
// intersectionWith
|
||||
|
||||
@ -624,6 +624,11 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper<number
|
||||
value; // $ExpectType AbcObject
|
||||
return 1;
|
||||
});
|
||||
// $ExpectType AbcObject[]
|
||||
_.intersectionBy(...[list], (value) => {
|
||||
value; // $ExpectType AbcObject
|
||||
return 0;
|
||||
});
|
||||
|
||||
_.chain(list).intersectionBy(list); // $ExpectType LoDashExplicitWrapper<AbcObject[]>
|
||||
_.chain(list).intersectionBy(list, "a"); // $ExpectType LoDashExplicitWrapper<AbcObject[]>
|
||||
@ -661,11 +666,21 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper<number
|
||||
value; // $ExpectType T1 | T2
|
||||
return {};
|
||||
});
|
||||
// $ExpectType LoDashImplicitWrapper<T1[]>
|
||||
_([t1]).intersectionBy(...[[t2]], (value) => {
|
||||
value; // $ExpectType T1 | T2
|
||||
return {};
|
||||
});
|
||||
// $ExpectType LoDashExplicitWrapper<T1[]>
|
||||
_.chain([t1]).intersectionBy([t2], (value) => {
|
||||
value; // $ExpectType T1 | T2
|
||||
return {};
|
||||
});
|
||||
// $ExpectType LoDashExplicitWrapper<T1[]>
|
||||
_.chain([t1]).intersectionBy(...[[t2]], (value) => {
|
||||
value; // $ExpectType T1 | T2
|
||||
return {};
|
||||
});
|
||||
}
|
||||
|
||||
// _.intersectionWith
|
||||
|
||||
4
types/lodash/ts3.1/common/array.d.ts
vendored
4
types/lodash/ts3.1/common/array.d.ts
vendored
@ -713,6 +713,10 @@ declare module "../index" {
|
||||
* @see _.intersectionBy
|
||||
*/
|
||||
intersectionBy<T>(array?: List<T> | null, ...values: Array<List<T>>): T[];
|
||||
/**
|
||||
* @see _.intersectionBy
|
||||
*/
|
||||
intersectionBy<T>(...values: Array<List<T> | ValueIteratee<T>>): T[];
|
||||
}
|
||||
interface Collection<T> {
|
||||
/**
|
||||
|
||||
@ -615,6 +615,11 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType CollectionChain<number>
|
||||
value; // $ExpectType AbcObject
|
||||
return 0;
|
||||
});
|
||||
// $ExpectType AbcObject[]
|
||||
_.intersectionBy(...[list], (value) => {
|
||||
value; // $ExpectType AbcObject
|
||||
return 0;
|
||||
});
|
||||
|
||||
_(list).intersectionBy(list); // $ExpectType Collection<AbcObject>
|
||||
_(list).intersectionBy(list, "a"); // $ExpectType Collection<AbcObject>
|
||||
@ -635,6 +640,11 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType CollectionChain<number>
|
||||
value; // $ExpectType AbcObject
|
||||
return null;
|
||||
});
|
||||
// $ExpectType CollectionChain<AbcObject>
|
||||
_.chain(list).intersectionBy(...[list], (value) => {
|
||||
value; // $ExpectType AbcObject
|
||||
return null;
|
||||
});
|
||||
|
||||
fp.intersectionBy("a", list, list); // $ExpectType AbcObject[]
|
||||
fp.intersectionBy("a", list, list); // $ExpectType AbcObject[]
|
||||
|
||||
Loading…
Reference in New Issue
Block a user