Skip to content

Commit 5bee563

Browse files
committed
Merge pull request DefinitelyTyped#3730 from NN---/patch-16
Use DictionaryIterator for Dictionary functions
2 parents 7447045 + 0373592 commit 5bee563

File tree

1 file changed

+30
-26
lines changed

1 file changed

+30
-26
lines changed

lodash/lodash.d.ts

Lines changed: 30 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2253,7 +2253,7 @@ declare module _ {
22532253
**/
22542254
countBy<T>(
22552255
collection: Dictionary<T>,
2256-
callback?: ListIterator<T, any>,
2256+
callback?: DictionaryIterator<T, any>,
22572257
thisArg?: any): Dictionary<number>;
22582258

22592259
/**
@@ -2338,7 +2338,7 @@ declare module _ {
23382338
**/
23392339
every<T>(
23402340
collection: Dictionary<T>,
2341-
callback?: ListIterator<T, boolean>,
2341+
callback?: DictionaryIterator<T, boolean>,
23422342
thisArg?: any): boolean;
23432343

23442344
/**
@@ -2410,7 +2410,7 @@ declare module _ {
24102410
**/
24112411
all<T>(
24122412
collection: Dictionary<T>,
2413-
callback?: ListIterator<T, boolean>,
2413+
callback?: DictionaryIterator<T, boolean>,
24142414
thisArg?: any): boolean;
24152415

24162416
/**
@@ -2497,7 +2497,7 @@ declare module _ {
24972497
**/
24982498
filter<T>(
24992499
collection: Dictionary<T>,
2500-
callback: ListIterator<T, boolean>,
2500+
callback: DictionaryIterator<T, boolean>,
25012501
thisArg?: any): T[];
25022502

25032503
/**
@@ -2569,7 +2569,7 @@ declare module _ {
25692569
**/
25702570
select<T>(
25712571
collection: Dictionary<T>,
2572-
callback: ListIterator<T, boolean>,
2572+
callback: DictionaryIterator<T, boolean>,
25732573
thisArg?: any): T[];
25742574

25752575
/**
@@ -2709,7 +2709,7 @@ declare module _ {
27092709
**/
27102710
find<T>(
27112711
collection: Dictionary<T>,
2712-
callback: ListIterator<T, boolean>,
2712+
callback: DictionaryIterator<T, boolean>,
27132713
thisArg?: any): T;
27142714

27152715
/**
@@ -2781,7 +2781,7 @@ declare module _ {
27812781
**/
27822782
detect<T>(
27832783
collection: Dictionary<T>,
2784-
callback: ListIterator<T, boolean>,
2784+
callback: DictionaryIterator<T, boolean>,
27852785
thisArg?: any): T;
27862786

27872787
/**
@@ -2853,7 +2853,7 @@ declare module _ {
28532853
**/
28542854
findWhere<T>(
28552855
collection: Dictionary<T>,
2856-
callback: ListIterator<T, boolean>,
2856+
callback: DictionaryIterator<T, boolean>,
28572857
thisArg?: any): T;
28582858

28592859
/**
@@ -2955,7 +2955,7 @@ declare module _ {
29552955
**/
29562956
findLast<T>(
29572957
collection: Dictionary<T>,
2958-
callback: ListIterator<T, boolean>,
2958+
callback: DictionaryIterator<T, boolean>,
29592959
thisArg?: any): T;
29602960

29612961
/**
@@ -3057,7 +3057,7 @@ declare module _ {
30573057
**/
30583058
forEach<T extends {}>(
30593059
object: Dictionary<T>,
3060-
callback: ObjectIterator<T, void>,
3060+
callback: DictionaryIterator<T, void>,
30613061
thisArg?: any): Dictionary<T>;
30623062

30633063
/**
@@ -3092,7 +3092,7 @@ declare module _ {
30923092
**/
30933093
each<T extends {}>(
30943094
object: Dictionary<T>,
3095-
callback: ObjectIterator<T, void>,
3095+
callback: DictionaryIterator<T, void>,
30963096
thisArg?: any): Dictionary<T>;
30973097

30983098
/**
@@ -3163,7 +3163,7 @@ declare module _ {
31633163
**/
31643164
forEachRight<T extends {}>(
31653165
object: Dictionary<T>,
3166-
callback: ObjectIterator<T, void>,
3166+
callback: DictionaryIterator<T, void>,
31673167
thisArg?: any): Dictionary<T>;
31683168

31693169
/**
@@ -3190,7 +3190,7 @@ declare module _ {
31903190
**/
31913191
eachRight<T extends {}>(
31923192
object: Dictionary<T>,
3193-
callback: ObjectIterator<T, void>,
3193+
callback: DictionaryIterator<T, void>,
31943194
thisArg?: any): Dictionary<T>;
31953195
}
31963196

@@ -3296,7 +3296,7 @@ declare module _ {
32963296
**/
32973297
groupBy<T>(
32983298
collection: Dictionary<T>,
3299-
callback?: ListIterator<T, any>,
3299+
callback?: DictionaryIterator<T, any>,
33003300
thisArg?: any): Dictionary<T[]>;
33013301

33023302
/**
@@ -3518,7 +3518,7 @@ declare module _ {
35183518
**/
35193519
map<T extends {}, TResult>(
35203520
object: Dictionary<T>,
3521-
callback: ObjectIterator<T, TResult>,
3521+
callback: DictionaryIterator<T, TResult>,
35223522
thisArg?: any): TResult[];
35233523

35243524
/**
@@ -3558,7 +3558,7 @@ declare module _ {
35583558
**/
35593559
collect<T extends {}, TResult>(
35603560
object: Dictionary<T>,
3561-
callback: ObjectIterator<T, TResult>,
3561+
callback: DictionaryIterator<T, TResult>,
35623562
thisArg?: any): TResult[];
35633563

35643564
/**
@@ -3657,7 +3657,7 @@ declare module _ {
36573657
**/
36583658
max<T>(
36593659
collection: Dictionary<T>,
3660-
callback?: ListIterator<T, any>,
3660+
callback?: DictionaryIterator<T, any>,
36613661
thisArg?: any): T;
36623662

36633663
/**
@@ -4290,7 +4290,7 @@ declare module _ {
42904290
**/
42914291
reject<T>(
42924292
collection: Dictionary<T>,
4293-
callback: ListIterator<T, boolean>,
4293+
callback: DictionaryIterator<T, boolean>,
42944294
thisArg?: any): T[];
42954295

42964296
/**
@@ -4501,7 +4501,7 @@ declare module _ {
45014501
**/
45024502
some<T>(
45034503
collection: Dictionary<T>,
4504-
callback?: ListIterator<T, boolean>,
4504+
callback?: DictionaryIterator<T, boolean>,
45054505
thisArg?: any): boolean;
45064506

45074507
/**
@@ -4581,7 +4581,7 @@ declare module _ {
45814581
**/
45824582
any<T>(
45834583
collection: Dictionary<T>,
4584-
callback?: ListIterator<T, boolean>,
4584+
callback?: DictionaryIterator<T, boolean>,
45854585
thisArg?: any): boolean;
45864586

45874587
/**
@@ -5524,7 +5524,7 @@ declare module _ {
55245524
**/
55255525
forIn<T>(
55265526
object: Dictionary<T>,
5527-
callback?: ObjectIterator<T, void>,
5527+
callback?: DictionaryIterator<T, void>,
55285528
thisArg?: any): Dictionary<T>;
55295529

55305530
/**
@@ -5557,7 +5557,7 @@ declare module _ {
55575557
**/
55585558
forInRight<T extends {}>(
55595559
object: Dictionary<T>,
5560-
callback?: ObjectIterator<T, void>,
5560+
callback?: DictionaryIterator<T, void>,
55615561
thisArg?: any): Dictionary<T>;
55625562

55635563
/**
@@ -5591,7 +5591,7 @@ declare module _ {
55915591
**/
55925592
forOwn<T extends {}>(
55935593
object: Dictionary<T>,
5594-
callback?: ObjectIterator<T, void>,
5594+
callback?: DictionaryIterator<T, void>,
55955595
thisArg?: any): Dictionary<T>;
55965596

55975597
/**
@@ -5624,7 +5624,7 @@ declare module _ {
56245624
**/
56255625
forOwnRight<T extends {}>(
56265626
object: Dictionary<T>,
5627-
callback?: ObjectIterator<T, void>,
5627+
callback?: DictionaryIterator<T, void>,
56285628
thisArg?: any): Dictionary<T>;
56295629
/**
56305630
* @see _.forOwnRight
@@ -6413,11 +6413,15 @@ declare module _ {
64136413
}
64146414

64156415
interface ListIterator<T, TResult> {
6416-
(value: T, index: number, list: T[]): TResult;
6416+
(value: T, index: number, collection: T[]): TResult;
6417+
}
6418+
6419+
interface DictionaryIterator<T, TResult> {
6420+
(value: T, key: string, collection: Dictionary<T>): TResult;
64176421
}
64186422

64196423
interface ObjectIterator<T, TResult> {
6420-
(element: T, key: string, list: any): TResult;
6424+
(element: T, key: string, collection: any): TResult;
64216425
}
64226426

64236427
interface MemoVoidIterator<T, TResult> {

0 commit comments

Comments
 (0)