From af80fa34293d95ef3a1ec18535235fafc6307dd5 Mon Sep 17 00:00:00 2001 From: David Driscoll Date: Sat, 18 Jan 2014 23:13:39 -0500 Subject: [PATCH] (feat): Updated function methods to be generic This allows those method signatures to be passed through, but gain the benefits of things like throttle, memoize. --- lodash/lodash.d.ts | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 5de99d755..68ee4f8df 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -2580,10 +2580,10 @@ declare module _ { * @param options.trailing Specify execution on the trailing edge of the timeout. * @return The new debounced function. **/ - debounce( - func: Function, + debounce( + func: T, wait: number, - options?: DebounceSettings): Function; + options?: DebounceSettings): T; } interface LoDashObjectWrapper { @@ -2670,9 +2670,9 @@ declare module _ { * @param resolver Hash function for storing the result of `fn`. * @return Returns the new memoizing function. **/ - memoize( - func: Function, - resolver?: (n: any) => string): Function; + memoize( + func: T, + resolver?: (n: any) => string): T; } //_.once @@ -2684,7 +2684,7 @@ declare module _ { * @param func Function to only execute once. * @return The new restricted function. **/ - once(func: Function): Function; + once(func: T): T; } //_.partial @@ -2733,10 +2733,10 @@ declare module _ { * @param options.trailing Specify execution on the trailing edge of the timeout. * @return The new throttled function. **/ - throttle( - func: any, + throttle( + func: T, wait: number, - options?: ThrottleSettings): Function; + options?: ThrottleSettings): T; } interface ThrottleSettings { @@ -3764,7 +3764,7 @@ declare module _ { **/ times( n: number, - callback: Function, + callback: (num: number) => TResult, context?: any): TResult[]; }