diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index ceb9ceffda..c4d46ab585 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -413,8 +413,9 @@ result = _.where(stoogesCombined, { 'quotes': ['Poifect!'] } *************/ var saves = ['profile', 'settings']; var asyncSave = (obj) => obj.done(); +var done: Function; -var done: Function = _.after(saves.length, function() { +done = _.after(saves.length, function() { console.log('Done saving!'); }); @@ -422,6 +423,14 @@ _.forEach(saves, function(type) { asyncSave({ 'type': type, 'complete': done }); }); +done = _(function() { + console.log('Done saving!'); +}).after(saves.length); + +_.forEach(saves, function(type) { + asyncSave({ 'type': type, 'complete': done }); +}); + var funcBind = function (greeting) { return greeting + ' ' + this.name }; // need a second var otherwise typescript thinks func signature is the above func type, // instead of the newly returned _bind => func type. diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 1ae6cce022..11fbfea796 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -1880,6 +1880,13 @@ declare module _ { n: number, func: Function): Function; + interface LoDashWrapper { + /** + * @see _.after + **/ + after(n: number): Function; + } + /** * Creates a function that, when called, invokes func with the this binding of thisArg * and prepends any additional bind arguments to those provided to the bound function.