From b016066da2eb69d96d9cbea8a77f7fa365589ec8 Mon Sep 17 00:00:00 2001 From: Greg Weber Date: Tue, 29 Oct 2013 18:07:56 -0700 Subject: [PATCH] fix whereValue types Dictionary was ruining type inference The new type of is more exact and does not mess up inference --- lodash/lodash.d.ts | 142 ++++++++++++++++++++++----------------------- 1 file changed, 71 insertions(+), 71 deletions(-) diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index d2c0d06d48..b78c92becd 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -358,9 +358,9 @@ declare module LoDash { * @see _.first * @param whereValue "_.where" style callback value **/ - first( + first( array: List, - whereValue: Dictionary): T[]; + whereValue: W): T[]; /** * @see _.first @@ -392,9 +392,9 @@ declare module LoDash { /** * @see _.first **/ - head( + head( array: List, - whereValue: Dictionary): T[]; + whereValue: W): T[]; /** * @see _.first @@ -426,9 +426,9 @@ declare module LoDash { /** * @see _.first **/ - take( + take( array: List, - whereValue: Dictionary): T[]; + whereValue: W): T[]; } //_.flatten @@ -450,7 +450,7 @@ declare module LoDash { **/ flatten( array: List, - isShallow?, + isShallow?: boolean, callback?: ListIterator, thisArg?: any): any[]; } @@ -460,7 +460,7 @@ declare module LoDash { * @see _.flatten **/ flatten( - isShallow?, + isShallow?: boolean, callback?: ListIterator, thisArg?: any): LoDashArrayWrapper; } @@ -547,9 +547,9 @@ declare module LoDash { * @see _.initial * @param whereValue _.where style callback **/ - initial( + initial( array: List, - whereValue: Dictionary): T[]; + whereValue: W): T[]; } //_.intersection @@ -609,9 +609,9 @@ declare module LoDash { * @see _.last * @param whereValue _.where style callback **/ - last( + last( array: List, - whereValue: Dictionary): T[]; + whereValue: W): T[]; } //_.lastIndexOf @@ -754,9 +754,9 @@ declare module LoDash { /** * @see _.rest **/ - rest( + rest( array: List, - whereValue: Dictionary, + whereValue: W, thisArg?: any): T[]; /** @@ -786,9 +786,9 @@ declare module LoDash { /** * @see _.rest **/ - drop( + drop( array: List, - whereValue: Dictionary, + whereValue: W, thisArg?: any): T[]; /** @@ -818,9 +818,9 @@ declare module LoDash { /** * @see _.rest **/ - tail( + tail( array: List, - whereValue: Dictionary, + whereValue: W, thisArg?: any): T[]; } @@ -852,7 +852,7 @@ declare module LoDash { * @see _.sortedIndex * @param pluckValue the _.pluck style callback **/ - sortedIndex( + sortedIndex( array: List, value: T, pluckValue: string): number; @@ -861,10 +861,10 @@ declare module LoDash { * @see _.sortedIndex * @param pluckValue the _.where style callback **/ - sortedIndex( + sortedIndex( array: List, value: T, - whereValue: Dictionary): number; + whereValue: W): number; } //_.union @@ -916,7 +916,7 @@ declare module LoDash { * @see _.uniq * @param pluckValue _.pluck style callback **/ - uniq( + uniq( array: List, isSorted?: boolean, pluckValue?: string): T[]; @@ -925,9 +925,9 @@ declare module LoDash { * @see _.uniq * @param whereValue _.where style callback **/ - uniq( + uniq( array: List, - whereValue?: Dictionary): T[]; + whereValue?: W): T[]; /** * @see _.uniq @@ -950,7 +950,7 @@ declare module LoDash { * @see _.uniq * @param pluckValue _.pluck style callback **/ - unique( + unique( array: List, isSorted?: boolean, pluckValue?: string): T[]; @@ -959,9 +959,9 @@ declare module LoDash { * @see _.uniq * @param whereValue _.where style callback **/ - unique( + unique( array: List, - whereValue?: Dictionary): T[]; + whereValue?: W): T[]; } //_.without @@ -1196,9 +1196,9 @@ declare module LoDash { * @see _.every * @param whereValue _.where style callback **/ - every( + every( collection: Collection, - whereValue: Dictionary): boolean; + whereValue: W): boolean; /** * @see _.every @@ -1220,9 +1220,9 @@ declare module LoDash { * @see _.every * @param whereValue _.where style callback **/ - all( + all( collection: Collection, - whereValue: Dictionary): boolean; + whereValue: W): boolean; } //_.filter @@ -1259,9 +1259,9 @@ declare module LoDash { * @see _.filter * @param pluckValue _.pluck style callback **/ - filter( + filter( collection: Collection, - whereValue: Dictionary): T[]; + whereValue: W): T[]; /** * @see _.filter @@ -1283,9 +1283,9 @@ declare module LoDash { * @see _.filter * @param pluckValue _.pluck style callback **/ - select( + select( collection: Collection, - whereValue: Dictionary): T[]; + whereValue: W): T[]; } interface LoDashArrayWrapper { @@ -1307,8 +1307,8 @@ declare module LoDash { * @see _.filter * @param pluckValue _.pluck style callback **/ - filter( - whereValue: Dictionary): T[]; + filter( + whereValue: W): T[]; /** * @see _.filter @@ -1328,8 +1328,8 @@ declare module LoDash { * @see _.filter * @param pluckValue _.pluck style callback **/ - select( - whereValue: Dictionary): T[]; + select( + whereValue: W): T[]; } //_.find @@ -1358,9 +1358,9 @@ declare module LoDash { * @see _.find * @param _.pluck style callback **/ - find( + find( collection: Collection, - whereValue: Dictionary): T; + whereValue: W): T; /** * @see _.find @@ -1382,9 +1382,9 @@ declare module LoDash { * @see _.find * @param _.pluck style callback **/ - detect( + detect( collection: Collection, - whereValue: Dictionary): T; + whereValue: W): T; /** * @see _.find @@ -1406,9 +1406,9 @@ declare module LoDash { * @see _.find * @param _.pluck style callback **/ - findWhere( + findWhere( collection: Collection, - whereValue: Dictionary): T; + whereValue: W): T; /** * @see _.find @@ -1438,9 +1438,9 @@ declare module LoDash { * @see _.find * @param _.pluck style callback **/ - findLast( + findLast( collection: Collection, - whereValue: Dictionary): T; + whereValue: W): T; /** * @see _.find @@ -1602,9 +1602,9 @@ declare module LoDash { * @see _.groupBy * @param whereValue _.where style callback **/ - groupBy( + groupBy( collection: List, - whereValue: Dictionary): Dictionary; + whereValue: W): Dictionary; } //_.indexBy @@ -1642,9 +1642,9 @@ declare module LoDash { * @see _.indexBy * @param whereValue _.where style callback **/ - indexBy( + indexBy( collection: List, - whereValue: Dictionary): Dictionary; + whereValue: W): Dictionary; } //_.invoke @@ -1773,9 +1773,9 @@ declare module LoDash { * @see _.max * @param whereValue _.where style callback **/ - max( + max( collection: Collection, - whereValue: Dictionary): T; + whereValue: W): T; } //_.min @@ -1813,9 +1813,9 @@ declare module LoDash { * @see _.min * @param whereValue _.where style callback **/ - min( + min( collection: Collection, - whereValue: Dictionary): T; + whereValue: W): T; } //_.pluck @@ -1930,9 +1930,9 @@ declare module LoDash { * @see _.reject * @param whereValue _.where style callback **/ - reject( + reject( collection: Collection, - whereValue: Dictionary): T[]; + whereValue: W): T[]; } //_.sample @@ -2021,9 +2021,9 @@ declare module LoDash { * @see _.some * @param whereValue _.where style callback **/ - some( + some( collection: Collection, - whereValue: Dictionary): boolean; + whereValue: W): boolean; /** * @see _.some @@ -2045,9 +2045,9 @@ declare module LoDash { * @see _.some * @param whereValue _.where style callback **/ - any( + any( collection: Collection, - whereValue: Dictionary): boolean; + whereValue: W): boolean; } //_.sortBy @@ -2085,9 +2085,9 @@ declare module LoDash { * @see _.sortBy * @param whereValue _.where style callback **/ - sortBy( + sortBy( collection: List, - whereValue: Dictionary): T[]; + whereValue: W): T[]; } //_.toArray @@ -2999,9 +2999,9 @@ declare module LoDash { * @see _.findKey * @param whereValue _.where style callback **/ - findKey( - object: any, - whereValue: Dictionary): string; + findKey, T extends W>( + object: T, + whereValue: W): string; } //_.findLastKey @@ -3030,9 +3030,9 @@ declare module LoDash { * @see _.findLastKey * @param whereValue _.where style callback **/ - findLastKey( - object: any, - whereValue: Dictionary): string; + findLastKey, T extends W>( + object: T, + whereValue: W): string; } //_.forIn @@ -3226,7 +3226,7 @@ declare module LoDash { isEqual( a: any, b: any, - callback?: (a, b) => boolean, + callback?: (a: any, b: any) => boolean, thisArg?: any): boolean; } @@ -3771,4 +3771,4 @@ declare module LoDash { interface Dictionary extends Collection { [index: string]: T; } -} \ No newline at end of file +}