From cc3afb220ccec886ff0eb715ad22167de19084d2 Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Sat, 7 Nov 2015 13:14:10 +0500 Subject: [PATCH] lodash: signatures of the method _.after have been changed --- lodash/lodash-tests.ts | 34 +++++++++++++++++++++++++--------- lodash/lodash.d.ts | 26 +++++++++++++++++--------- 2 files changed, 42 insertions(+), 18 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 876547fd6..da04e9a9c 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -3262,17 +3262,33 @@ module TestNow { /************* * Functions * *************/ -var saves = ['profile', 'settings']; -var asyncSave = (obj: any) => obj.done(); -var done: Function; -done = _.after(saves.length, function () { - console.log('Done saving!'); -}); +// _after +module TestAfter { + interface Func { + (a: string, b: number): boolean; + } -done = _(saves.length).after(function () { - console.log('Done saving!'); -}).value(); + let func: Func; + + { + let result: Func; + + _.after(42, func); + } + + { + let result: _.LoDashImplicitObjectWrapper; + + _(42).after(func); + } + + { + let result: _.LoDashExplicitObjectWrapper; + + _(42).chain().after(func); + } +} // _.ary result = ['6', '8', '10'].map(_.ary<(s: string) => number>(parseInt, 1)); diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 359cc0fb9..93ea9733f 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -6779,22 +6779,30 @@ declare module _ { //_.after interface LoDashStatic { /** - * Creates a function that executes func, with the this binding and arguments of the - * created function, only after being called n times. - * @param n The number of times the function must be called before func is executed. - * @param func The function to restrict. - * @return The new restricted function. - **/ - after( + * The opposite of _.before; this method creates a function that invokes func once it’s called n or more times. + * + * @param n The number of calls before func is invoked. + * @param func The function to restrict. + * @return Returns the new restricted function. + */ + after( n: number, - func: Function): Function; + func: TFunc + ): TFunc; } interface LoDashImplicitWrapper { /** * @see _.after **/ - after(func: Function): LoDashImplicitObjectWrapper; + after(func: TFunc): LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.after + **/ + after(func: TFunc): LoDashExplicitObjectWrapper; } //_.ary