mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
fix: Use ListIterator for the remove predicate. (#38897)
* Use ListIterator for the remove predicate. * generate fp
This commit is contained in:
parent
6090a81c7d
commit
a55ab31b74
6
types/lodash/common/array.d.ts
vendored
6
types/lodash/common/array.d.ts
vendored
@ -1858,7 +1858,7 @@ declare module "../index" {
|
||||
*/
|
||||
remove<T>(
|
||||
array: List<T>,
|
||||
predicate?: ListIteratee<T>
|
||||
predicate?: ListIterator<T, NotVoid>
|
||||
): T[];
|
||||
}
|
||||
|
||||
@ -1868,7 +1868,7 @@ declare module "../index" {
|
||||
*/
|
||||
remove<T>(
|
||||
this: LoDashImplicitWrapper<List<T>>,
|
||||
predicate?: ListIteratee<T>
|
||||
predicate?: ListIterator<T, NotVoid>
|
||||
): LoDashImplicitWrapper<T[]>;
|
||||
}
|
||||
|
||||
@ -1878,7 +1878,7 @@ declare module "../index" {
|
||||
*/
|
||||
remove<T>(
|
||||
this: LoDashExplicitWrapper<List<T>>,
|
||||
predicate?: ListIteratee<T>
|
||||
predicate?: ListIterator<T, NotVoid>
|
||||
): LoDashExplicitWrapper<T[]>;
|
||||
}
|
||||
|
||||
|
||||
6
types/lodash/fp.d.ts
vendored
6
types/lodash/fp.d.ts
vendored
@ -3740,12 +3740,12 @@ declare namespace _ {
|
||||
type LodashReject1x2<T> = (predicate: lodash.ValueIterateeCustom<T, boolean>) => T[];
|
||||
type LodashReject2x2<T> = (predicate: lodash.ValueIterateeCustom<T[keyof T], boolean>) => Array<T[keyof T]>;
|
||||
interface LodashRemove {
|
||||
<T>(predicate: lodash.ValueIteratee<T>): LodashRemove1x1<T>;
|
||||
<T>(predicate: (value: T) => lodash.NotVoid): LodashRemove1x1<T>;
|
||||
<T>(predicate: lodash.__, array: lodash.List<T>): LodashRemove1x2<T>;
|
||||
<T>(predicate: lodash.ValueIteratee<T>, array: lodash.List<T>): T[];
|
||||
<T>(predicate: (value: T) => lodash.NotVoid, array: lodash.List<T>): T[];
|
||||
}
|
||||
type LodashRemove1x1<T> = (array: lodash.List<T>) => T[];
|
||||
type LodashRemove1x2<T> = (predicate: lodash.ValueIteratee<T>) => T[];
|
||||
type LodashRemove1x2<T> = (predicate: (value: T) => lodash.NotVoid) => T[];
|
||||
interface LodashRepeat {
|
||||
(n: number): LodashRepeat1x1;
|
||||
(n: lodash.__, string: string): LodashRepeat1x2;
|
||||
|
||||
@ -1074,23 +1074,15 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper<number
|
||||
|
||||
_.remove(list); // $ExpectType AbcObject[]
|
||||
_.remove(list, listIterator); // $ExpectType AbcObject[]
|
||||
_.remove(list, ""); // $ExpectType AbcObject[]
|
||||
_.remove(list, { a: 42 }); // $ExpectType AbcObject[]
|
||||
|
||||
_(list).remove(); // $ExpectType LoDashImplicitWrapper<AbcObject[]>
|
||||
_(list).remove(listIterator); // $ExpectType LoDashImplicitWrapper<AbcObject[]>
|
||||
_(list).remove(""); // $ExpectType LoDashImplicitWrapper<AbcObject[]>
|
||||
_(list).remove({ a: 42 }); // $ExpectType LoDashImplicitWrapper<AbcObject[]>
|
||||
|
||||
_.chain(list).remove(); // $ExpectType LoDashExplicitWrapper<AbcObject[]>
|
||||
_.chain(list).remove(listIterator); // $ExpectType LoDashExplicitWrapper<AbcObject[]>
|
||||
_.chain(list).remove(""); // $ExpectType LoDashExplicitWrapper<AbcObject[]>
|
||||
_.chain(list).remove({ a: 42 }); // $ExpectType LoDashExplicitWrapper<AbcObject[]>
|
||||
|
||||
fp.remove(valueIterator, list); // $ExpectType AbcObject[]
|
||||
fp.remove(valueIterator)(list); // $ExpectType AbcObject[]
|
||||
fp.remove("", list); // $ExpectType AbcObject[]
|
||||
fp.remove({ a: 42 }, list); // $ExpectType AbcObject[]
|
||||
}
|
||||
|
||||
// _.tail
|
||||
|
||||
6
types/lodash/ts3.1/common/array.d.ts
vendored
6
types/lodash/ts3.1/common/array.d.ts
vendored
@ -1115,19 +1115,19 @@ declare module "../index" {
|
||||
* @param predicate The function invoked per iteration.
|
||||
* @return Returns the new array of removed elements.
|
||||
*/
|
||||
remove<T>(array: List<T>, predicate?: ListIteratee<T>): T[];
|
||||
remove<T>(array: List<T>, predicate?: ListIterator<T, NotVoid>): T[];
|
||||
}
|
||||
interface Collection<T> {
|
||||
/**
|
||||
* @see _.remove
|
||||
*/
|
||||
remove(predicate?: ListIteratee<T>): Collection<T>;
|
||||
remove(predicate?: ListIterator<T, NotVoid>): Collection<T>;
|
||||
}
|
||||
interface CollectionChain<T> {
|
||||
/**
|
||||
* @see _.remove
|
||||
*/
|
||||
remove(predicate?: ListIteratee<T>): CollectionChain<T>;
|
||||
remove(predicate?: ListIterator<T, NotVoid>): CollectionChain<T>;
|
||||
}
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
|
||||
6
types/lodash/ts3.1/fp.d.ts
vendored
6
types/lodash/ts3.1/fp.d.ts
vendored
@ -3723,12 +3723,12 @@ declare namespace _ {
|
||||
type LodashReject1x2<T> = (predicate: lodash.ValueIterateeCustom<T, boolean>) => T[];
|
||||
type LodashReject2x2<T> = (predicate: lodash.ValueIterateeCustom<T[keyof T], boolean>) => Array<T[keyof T]>;
|
||||
interface LodashRemove {
|
||||
<T>(predicate: lodash.ValueIteratee<T>): LodashRemove1x1<T>;
|
||||
<T>(predicate: (value: T) => lodash.NotVoid): LodashRemove1x1<T>;
|
||||
<T>(predicate: lodash.__, array: lodash.List<T>): LodashRemove1x2<T>;
|
||||
<T>(predicate: lodash.ValueIteratee<T>, array: lodash.List<T>): T[];
|
||||
<T>(predicate: (value: T) => lodash.NotVoid, array: lodash.List<T>): T[];
|
||||
}
|
||||
type LodashRemove1x1<T> = (array: lodash.List<T>) => T[];
|
||||
type LodashRemove1x2<T> = (predicate: lodash.ValueIteratee<T>) => T[];
|
||||
type LodashRemove1x2<T> = (predicate: (value: T) => lodash.NotVoid) => T[];
|
||||
interface LodashRepeat {
|
||||
(n: number): LodashRepeat1x1;
|
||||
(n: lodash.__, string: string): LodashRepeat1x2;
|
||||
|
||||
@ -1082,23 +1082,15 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType CollectionChain<number>
|
||||
|
||||
_.remove(list); // $ExpectType AbcObject[]
|
||||
_.remove(list, listIterator); // $ExpectType AbcObject[]
|
||||
_.remove(list, ""); // $ExpectType AbcObject[]
|
||||
_.remove(list, { a: 42 }); // $ExpectType AbcObject[]
|
||||
|
||||
_(list).remove(); // $ExpectType Collection<AbcObject>
|
||||
_(list).remove(listIterator); // $ExpectType Collection<AbcObject>
|
||||
_(list).remove(""); // $ExpectType Collection<AbcObject>
|
||||
_(list).remove({ a: 42 }); // $ExpectType Collection<AbcObject>
|
||||
|
||||
_.chain(list).remove(); // $ExpectType CollectionChain<AbcObject>
|
||||
_.chain(list).remove(listIterator); // $ExpectType CollectionChain<AbcObject>
|
||||
_.chain(list).remove(""); // $ExpectType CollectionChain<AbcObject>
|
||||
_.chain(list).remove({ a: 42 }); // $ExpectType CollectionChain<AbcObject>
|
||||
|
||||
fp.remove(valueIterator, list); // $ExpectType AbcObject[]
|
||||
fp.remove(valueIterator)(list); // $ExpectType AbcObject[]
|
||||
fp.remove("", list); // $ExpectType AbcObject[]
|
||||
fp.remove({ a: 42 }, list); // $ExpectType AbcObject[]
|
||||
}
|
||||
|
||||
// _.tail
|
||||
|
||||
Loading…
Reference in New Issue
Block a user