From bc664db5212182aa61ee6fb1b3935bc1ffbd29dc Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Sat, 28 Nov 2015 10:00:09 +0500 Subject: [PATCH] lodash: signatures of _.defer have been changed --- lodash/lodash-tests.ts | 35 +++++++++++++++++++++++++++++++++-- lodash/lodash.d.ts | 31 ++++++++++++++++++++----------- 2 files changed, 53 insertions(+), 13 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index bdc08ccdc..7a477f585 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -4490,8 +4490,39 @@ source.addEventListener('message', <_.LoDashImplicitObjectWrapper>_(fu var returnedDebounce = _.throttle(function (a: any) { return a * 5; }, 5); returnedThrottled(4); -result = _.defer(function () { console.log('deferred'); }); -result = <_.LoDashImplicitWrapper>_(function () { console.log('deferred'); }).defer(); +// _.defer +module TestDefer { + type SampleFunc = (a: number, b: string) => boolean; + + let func: SampleFunc; + + { + let result: number; + + result = _.defer(func); + result = _.defer(func, any); + result = _.defer(func, any, any); + result = _.defer(func, any, any, any); + } + + { + let result: _.LoDashImplicitWrapper; + + result = _(func).defer(); + result = _(func).defer(any); + result = _(func).defer(any, any); + result = _(func).defer(any, any, any); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _(func).chain().defer(); + result = _(func).chain().defer(any); + result = _(func).chain().defer(any, any); + result = _(func).chain().defer(any, any, any); + } +} // _.delay module TestDelay { diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index ad465c5c3..23c1ae4f2 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -7913,24 +7913,33 @@ declare module _ { //_.defer interface LoDashStatic { /** - * Defers executing the func function until the current call stack has cleared. Additional - * arguments will be provided to func when it is invoked. - * @param func The function to defer. - * @param args Arguments to invoke the function with. - * @return The timer id. - **/ - defer( - func: Function, - ...args: any[]): number; + * Defers invoking the func until the current call stack has cleared. Any additional arguments are provided to + * func when it’s invoked. + * + * @param func The function to defer. + * @param args The arguments to invoke the function with. + * @return Returns the timer id. + */ + defer( + func: T, + ...args: any[] + ): number; } interface LoDashImplicitObjectWrapper { /** - * @see _.defer - **/ + * @see _.defer + */ defer(...args: any[]): LoDashImplicitWrapper; } + interface LoDashExplicitObjectWrapper { + /** + * @see _.defer + */ + defer(...args: any[]): LoDashExplicitWrapper; + } + //_.delay interface LoDashStatic { /**