From b016066da2eb69d96d9cbea8a77f7fa365589ec8 Mon Sep 17 00:00:00 2001 From: Greg Weber Date: Tue, 29 Oct 2013 18:07:56 -0700 Subject: [PATCH 1/5] 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 d2c0d06d4..b78c92bec 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 +} From 7af17a2d8e4cab124b1ff689f43f73288435bde6 Mon Sep 17 00:00:00 2001 From: Greg Weber Date: Tue, 29 Oct 2013 18:54:06 -0700 Subject: [PATCH 2/5] use generic sub-typing for omit & pick --- lodash/lodash.d.ts | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index b78c92bec..aa1800164 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -3474,24 +3474,24 @@ declare module LoDash { * @param keys The properties to omit. * @return An object without the omitted properties. **/ - omit( - object: any, - ...keys: string[]): any; + omit( + object: T, + ...keys: string[]): Omitted; /** * @see _.omit **/ - omit( - object: any, - keys: string[]): any; + omit( + object: T, + keys: string[]): Omitted; /** * @see _.omit **/ - omit( - object: any, - callback: ObjectIterator, - thisArg?: any): any; + omit( + object: T, + callback: ObjectIterator, + thisArg?: any): Omitted; } //_.pairs @@ -3517,24 +3517,24 @@ declare module LoDash { * @param keys Property names to pick * @return An object composed of the picked properties. **/ - pick( - object: any, - ...keys: string[]): any; + pick( + object: T, + ...keys: string[]): Picked; /** * @see _.pick **/ - pick( - object: any, - keys: string[]): any; + pick( + object: T, + keys: string[]): Picked; /** * @see _.pick **/ - pick( - object: any, + pick( + object: T, callback: ObjectIterator, - thisArg?: any): any; + thisArg?: any): Picked; } //_.transform From d69c847f25ac2da6bda85e995998be56fc8d1064 Mon Sep 17 00:00:00 2001 From: Greg Weber Date: Tue, 29 Oct 2013 18:58:23 -0700 Subject: [PATCH 3/5] name module _ rather than LoDash --- lodash/lodash.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index aa1800164..d41f1b782 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -1,6 +1,6 @@ -declare var _: LoDash.LoDashStatic; +declare var _: _.LoDashStatic; -declare module LoDash { +declare module _ { interface LoDashStatic { (value: number): LoDashWrapper; (value: string): LoDashWrapper; From 01932853dfb411765d3f488229c185770ee21426 Mon Sep 17 00:00:00 2001 From: Greg Weber Date: Wed, 30 Oct 2013 07:57:42 -0700 Subject: [PATCH 4/5] fix types based on tests --- lodash/lodash-tests.ts | 158 +++++++++++++------------- lodash/lodash.d.ts | 251 ++++++++++++++++++++++++++--------------- 2 files changed, 237 insertions(+), 172 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 2161f4a95..1f2c9ca80 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -80,46 +80,46 @@ Dog.prototype.bark = function() { console.log('Woof, woof!'); }; -var result; +var result : any; /************* * Chaining * *************/ -result = >_('test'); -result = >_(1); -result = >_(true); -result = >_(['test1', 'test2']); -result = >>_({'key1': 'test1', 'key2': 'test2'}); +result = <_.LoDashWrapper>_('test'); +result = <_.LoDashWrapper>_(1); +result = <_.LoDashWrapper>_(true); +result = <_.LoDashArrayWrapper>_(['test1', 'test2']); +result = <_.LoDashObjectWrapper<_.Dictionary>>_({'key1': 'test1', 'key2': 'test2'}); -result = >_.chain('test'); -result = >_('test').chain(); -result = >_.chain(1); -result = >_(1).chain(); -result = >_.chain(true); -result = >_(true).chain(); -result = >_.chain(['test1', 'test2']); -result = >_(['test1', 'test2']).chain(); -result = >>_.chain({'key1': 'test1', 'key2': 'test2'}); -result = >>_({'key1': 'test1', 'key2': 'test2'}).chain(); +result = <_.LoDashWrapper>_.chain('test'); +result = <_.LoDashWrapper>_('test').chain(); +result = <_.LoDashWrapper>_.chain(1); +result = <_.LoDashWrapper>_(1).chain(); +result = <_.LoDashWrapper>_.chain(true); +result = <_.LoDashWrapper>_(true).chain(); +result = <_.LoDashArrayWrapper>_.chain(['test1', 'test2']); +result = <_.LoDashArrayWrapper>_(['test1', 'test2']).chain(); +result = <_.LoDashObjectWrapper<_.Dictionary>>_.chain({'key1': 'test1', 'key2': 'test2'}); +result = <_.LoDashObjectWrapper<_.Dictionary>>_({'key1': 'test1', 'key2': 'test2'}).chain(); //Wrapped array shortcut methods -result = >_([1, 2, 3, 4]).concat(5, 6); -result = >_([1, 2, 3, 4]).join(','); -result = >_([1, 2, 3, 4]).pop(); +result = <_.LoDashArrayWrapper>_([1, 2, 3, 4]).concat(5, 6); +result = <_.LoDashWrapper>_([1, 2, 3, 4]).join(','); +result = <_.LoDashWrapper>_([1, 2, 3, 4]).pop(); _([1, 2, 3, 4]).push(5, 6, 7); -result = >_([1, 2, 3, 4]).reverse(); -result = >_([1, 2, 3, 4]).shift(); -result = >_([1, 2, 3, 4]).slice(1, 2); -result = >_([1, 2, 3, 4]).slice(2); -result = >_([1, 2, 3, 4]).sort((a, b) => 1); -result = >_([1, 2, 3, 4]).splice(1); -result = >_([1, 2, 3, 4]).splice(1, 2, 5, 6); -result = >_([1, 2, 3, 4]).unshift(5, 6); +result = <_.LoDashArrayWrapper>_([1, 2, 3, 4]).reverse(); +result = <_.LoDashWrapper>_([1, 2, 3, 4]).shift(); +result = <_.LoDashArrayWrapper>_([1, 2, 3, 4]).slice(1, 2); +result = <_.LoDashArrayWrapper>_([1, 2, 3, 4]).slice(2); +result = <_.LoDashArrayWrapper>_([1, 2, 3, 4]).sort((a, b) => 1); +result = <_.LoDashArrayWrapper>_([1, 2, 3, 4]).splice(1); +result = <_.LoDashArrayWrapper>_([1, 2, 3, 4]).splice(1, 2, 5, 6); +result = <_.LoDashWrapper>_([1, 2, 3, 4]).unshift(5, 6); result = _.tap([1, 2, 3, 4], function(array) { console.log(array); }); -result = >_('test').tap(function(value) { console.log(value); }); -result = >_([1, 2, 3, 4]).tap(function(array) { console.log(array); }); -result = >>_({'key1': 'test1', 'key2': 'test2'}).tap(function(array) { console.log(array); }); +result = <_.LoDashWrapper>_('test').tap(function(value) { console.log(value); }); +result = <_.LoDashArrayWrapper>_([1, 2, 3, 4]).tap(function(array) { console.log(array); }); +result = <_.LoDashObjectWrapper<_.Dictionary>>_({'key1': 'test1', 'key2': 'test2'}).tap(function(array) { console.log(array); }); result = _('test').toString(); result = _([1, 2, 3]).toString(); @@ -127,20 +127,20 @@ result = _({'key1': 'test1', 'key2': 'test2'}).toString(); result = _('test').valueOf(); result = _([1, 2, 3]).valueOf(); -result = >_({'key1': 'test1', 'key2': 'test2'}).valueOf(); +result = <_.Dictionary>_({'key1': 'test1', 'key2': 'test2'}).valueOf(); result = _('test').value(); result = _([1, 2, 3]).value(); -result = >_({'key1': 'test1', 'key2': 'test2'}).value(); +result = <_.Dictionary>_({'key1': 'test1', 'key2': 'test2'}).value(); // /************* // * Arrays * // *************/ result = _.compact([0, 1, false, 2, '', 3]); - result = >_([0, 1, false, 2, '', 3]).compact(); + result = <_.LoDashArrayWrapper>_([0, 1, false, 2, '', 3]).compact(); result = _.difference([1, 2, 3, 4, 5], [5, 2, 10]); - result = >_([1, 2, 3, 4, 5]).difference([5, 2, 10]); + result = <_.LoDashArrayWrapper>_([1, 2, 3, 4, 5]).difference([5, 2, 10]); result = _.rest([1, 2, 3]); result = _.rest([1, 2, 3], 2); @@ -148,6 +148,7 @@ result = _.rest([1, 2, 3], function(num) { return num < 3; }); result = _.rest(foodsOrganic, 'test'); +var result : any; result = _.rest(foodsType, { 'test': 'value' }); result = _.drop([1, 2, 3]); @@ -196,9 +197,7 @@ result = _.first(foodsType, { 'type': 'fruit' }); result = _.take([1, 2, 3]); result = _.take([1, 2, 3], 2); - result = _.take([1, 2, 3], function(num) { - return num < 3; - }); + result = _.take([1, 2, 3], (num) => num < 3); result = _.take(foodsOrganic, 'organic'); result = _.take(foodsType, { 'type': 'fruit' }); @@ -206,9 +205,10 @@ result = _.flatten([1, [2], [3, [[4]]]]); result = _.flatten([1, [2], [3, [[4]]]], true); result = _.flatten(stoogesQuotes, 'quotes'); - result = >_([1, [2], [3, [[4]]]]).flatten(); - result = >_([1, [2], [3, [[4]]]]).flatten(true); - result = >_(stoogesQuotes).flatten('quotes'); +var result: any + result = <_.LoDashArrayWrapper>_([1, [2], [3, [[4]]]]).flatten(); + result = <_.LoDashArrayWrapper>_([1, [2], [3, [[4]]]]).flatten(true); + result = <_.LoDashArrayWrapper>_(stoogesQuotes).flatten('quotes'); result = _.indexOf([1, 2, 3, 1, 2, 3], 2); result = _.indexOf([1, 2, 3, 1, 2, 3], 2, 3); @@ -303,13 +303,13 @@ result = _.contains('curly', 'ur'); result = _.include({ 'name': 'moe', 'age': 40 }, 'moe'); result = _.include('curly', 'ur'); -result = >_.countBy([4.3, 6.1, 6.4], function(num) { return Math.floor(num); }); -result = >_.countBy([4.3, 6.1, 6.4], function(num) { return this.floor(num); }, Math); -result = >_.countBy(['one', 'two', 'three'], 'length'); +result = <_.Dictionary>_.countBy([4.3, 6.1, 6.4], function(num) { return Math.floor(num); }); +result = <_.Dictionary>_.countBy([4.3, 6.1, 6.4], function(num) { return this.floor(num); }, Math); +result = <_.Dictionary>_.countBy(['one', 'two', 'three'], 'length'); - result = >>_([4.3, 6.1, 6.4]).countBy(function(num) { return Math.floor(num); }); - result = >>_([4.3, 6.1, 6.4]).countBy(function(num) { return this.floor(num); }, Math); - result = >>_(['one', 'two', 'three']).countBy('length'); + result = <_.LoDashObjectWrapper<_.Dictionary>>_([4.3, 6.1, 6.4]).countBy(function(num) { return Math.floor(num); }); + result = <_.LoDashObjectWrapper<_.Dictionary>>_([4.3, 6.1, 6.4]).countBy(function(num) { return this.floor(num); }, Math); + result = <_.LoDashObjectWrapper<_.Dictionary>>_(['one', 'two', 'three']).countBy('length'); result = _.every([true, 1, null, 'yes'], Boolean); result = _.every(stoogesAges, 'age'); @@ -360,30 +360,30 @@ result = _.findLast(foodsCombined, { 'type': 'vegetable' }); result = _.findLast(foodsCombined, 'organic'); result = _.forEach([1, 2, 3], function(num) { console.log(num); }); -result = >_.forEach({ 'one': 1, 'two': 2, 'three': 3 }, function(num) { console.log(num); }); +result = <_.Dictionary>_.forEach({ 'one': 1, 'two': 2, 'three': 3 }, function(num) { console.log(num); }); result = _.each([1, 2, 3], function(num) { console.log(num); }); - result = >_.each({ 'one': 1, 'two': 2, 'three': 3 }, function(num) { console.log(num); }); + result = <_.Dictionary>_.each({ 'one': 1, 'two': 2, 'three': 3 }, function(num) { console.log(num); }); - result = >_([1, 2, 3]).forEach(function(num) { console.log(num); }); - result = >>_({ 'one': 1, 'two': 2, 'three': 3 }).forEach(function(num) { console.log(num); }); + result = <_.LoDashArrayWrapper>_([1, 2, 3]).forEach(function(num) { console.log(num); }); + result = <_.LoDashObjectWrapper<_.Dictionary>>_({ 'one': 1, 'two': 2, 'three': 3 }).forEach(function(num) { console.log(num); }); - result = >_([1, 2, 3]).each(function(num) { console.log(num); }); - result = >>_({ 'one': 1, 'two': 2, 'three': 3 }).each(function(num) { console.log(num); }); + result = <_.LoDashArrayWrapper>_([1, 2, 3]).each(function(num) { console.log(num); }); + result = <_.LoDashObjectWrapper<_.Dictionary>>_({ 'one': 1, 'two': 2, 'three': 3 }).each(function(num) { console.log(num); }); result = _.forEachRight([1, 2, 3], function(num) { console.log(num); }); -result = >_.forEachRight({ 'one': 1, 'two': 2, 'three': 3 }, function(num) { console.log(num); }); +result = <_.Dictionary>_.forEachRight({ 'one': 1, 'two': 2, 'three': 3 }, function(num) { console.log(num); }); result = _.eachRight([1, 2, 3], function(num) { console.log(num); }); - result = >_.eachRight({ 'one': 1, 'two': 2, 'three': 3 }, function(num) { console.log(num); }); + result = <_.Dictionary>_.eachRight({ 'one': 1, 'two': 2, 'three': 3 }, function(num) { console.log(num); }); -result = >_.groupBy([4.2, 6.1, 6.4], function(num) { return Math.floor(num); }); -result = >_.groupBy([4.2, 6.1, 6.4], function(num) { return this.floor(num); }, Math); -result = >_.groupBy(['one', 'two', 'three'], 'length'); +result = <_.Dictionary>_.groupBy([4.2, 6.1, 6.4], function(num) { return Math.floor(num); }); +result = <_.Dictionary>_.groupBy([4.2, 6.1, 6.4], function(num) { return this.floor(num); }, Math); +result = <_.Dictionary>_.groupBy(['one', 'two', 'three'], 'length'); -result = >_.indexBy(keys, 'dir'); -result = >_.indexBy(keys, function(key) { return String.fromCharCode(key.code); }); -result = >_.indexBy(keys, function(key) { this.fromCharCode(key.code); }, String); +result = <_.Dictionary>_.indexBy(keys, 'dir'); +result = <_.Dictionary>_.indexBy(keys, function(key) { return String.fromCharCode(key.code); }); +result = <_.Dictionary>_.indexBy(keys, function(key) { this.fromCharCode(key.code); }, String); result = _.invoke([[5, 1, 7], [3, 2, 1]], 'sort'); result = _.invoke([123, 456], String.prototype.split, ''); @@ -537,19 +537,19 @@ var greet = function(formatted) { }; result = _.compose(greet, format); -result = >_(greet).compose(format); +result = <_.LoDashObjectWrapper>_(greet).compose(format); var createCallbackObj = { name: 'Joe' }; result = <() => any>_.createCallback('name'); result = <() => boolean>_.createCallback(createCallbackObj); -result = any>>_('name').createCallback(); -result = boolean>>_(createCallbackObj).createCallback(); +result = <_.LoDashObjectWrapper<() => any>>_('name').createCallback(); +result = <_.LoDashObjectWrapper<() => boolean>>_(createCallbackObj).createCallback(); result = _.curry(function(a, b, c) { console.log(a + b + c); }); -result = >_(function(a, b, c) { +result = <_.LoDashObjectWrapper>_(function(a, b, c) { console.log(a + b + c); }).curry(); @@ -565,23 +565,23 @@ source.addEventListener('message', _.debounce(function() {}, 250, { 'maxWait': 1000 }), false); -result = >_(function() {}).debounce(150); +result = <_.LoDashObjectWrapper>_(function() {}).debounce(150); -jQuery('#postbox').on('click', >_(function() {}).debounce(300, { +jQuery('#postbox').on('click', <_.LoDashObjectWrapper>_(function() {}).debounce(300, { 'leading': true, 'trailing': false })); -source.addEventListener('message', >_(function() {}).debounce(250, { +source.addEventListener('message', <_.LoDashObjectWrapper>_(function() {}).debounce(250, { 'maxWait': 1000 }), false); result = _.defer(function() { console.log('deferred'); }); -result = >_(function() { console.log('deferred'); }).defer(); +result = <_.LoDashWrapper>_(function() { console.log('deferred'); }).defer(); var log = _.bind(console.log, console); result = _.delay(log, 1000, 'logged later'); -result = >_(log).delay(1000, 'logged later'); +result = <_.LoDashWrapper>_(log).delay(1000, 'logged later'); var fibonacci = _.memoize(function(n) { return n < 2 ? n : fibonacci(n - 1) + fibonacci(n - 2); @@ -636,8 +636,8 @@ result = _.assign({ 'name': 'moe' }, { 'age': 40 }, function(a, b) { return typeof a == 'undefined' ? b : a; }); -result = >_({ 'name': 'moe' }).assign({ 'age': 40 }); -result = >_({ 'name': 'moe' }).assign({ 'age': 40 }, function(a, b) { +result = <_.LoDashObjectWrapper>_({ 'name': 'moe' }).assign({ 'age': 40 }); +result = <_.LoDashObjectWrapper>_({ 'name': 'moe' }).assign({ 'age': 40 }, function(a, b) { return typeof a == 'undefined' ? b : a; }); @@ -646,8 +646,8 @@ result = >_({ 'name': 'moe' }).assign({ 'age': 4 return typeof a == 'undefined' ? b : a; }); - result = >_({ 'name': 'moe' }).extend({ 'age': 40 }); - result = >_({ 'name': 'moe' }).extend({ 'age': 40 }, function(a, b) { + result = <_.LoDashObjectWrapper>_({ 'name': 'moe' }).extend({ 'age': 40 }); + result = <_.LoDashObjectWrapper>_({ 'name': 'moe' }).extend({ 'age': 40 }, function(a, b) { return typeof a == 'undefined' ? b : a; }); @@ -861,7 +861,7 @@ result = _.result(object, 'stuff'); var tempObject = {}; result = _.runInContext(tempObject); -result = _.template('hello <%= name %>'); +result = <_.TemplateExecutor>_.template('hello <%= name %>'); result = _.template('<%- value %>', { 'value': '