diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index d7d8e3562..cd9a08808 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -813,13 +813,25 @@ result = <() => boolean>_.createCallback(createCallbackObj); result = <_.LoDashObjectWrapper<() => any>>_('name').createCallback(); result = <_.LoDashObjectWrapper<() => boolean>>_(createCallbackObj).createCallback(); -result = _.curry(function (a: any, b: any, c: any) { - console.log(a + b + c); -}); +// _.curry +var testCurryFn = (a: number, b: number, c: number) => [a, b, c]; +interface TestCurryResultFn { + (...args: number[]): number[] | TestCurryResultFn; +} +result = _.curry(testCurryFn)(1, 2, 3); +result = _.curry(testCurryFn)(1); +result = _(testCurryFn).curry().value()(1, 2, 3); +result = _(testCurryFn).curry().value()(1); -result = <_.LoDashObjectWrapper>_(function (a: any, b: any, c: any) { - console.log(a + b + c); -}).curry(); +// _.curryRight +var testCurryRightFn = (a: number, b: number, c: number) => [a, b, c]; +interface TestCurryRightResultFn { + (...args: number[]): number[] | TestCurryRightResultFn; +} +result = _.curryRight(testCurryRightFn)(1, 2, 3); +result = _.curryRight(testCurryRightFn)(1); +result = _(testCurryRightFn).curryRight().value()(1, 2, 3); +result = _(testCurryRightFn).curryRight().value()(1); declare var source: any; result = _.debounce(function () { }, 150); diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 2fc5536bf..7fc61133c 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -5335,24 +5335,44 @@ declare module _ { //_.curry interface LoDashStatic { /** - * Creates a function which accepts one or more arguments of func that when invoked either - * executes func returning its result, if all func arguments have been provided, or returns - * a function that accepts one or more of the remaining func arguments, and so on. The arity - * of func can be specified if func.length is not sufficient. - * @param func The function to curry. - * @param arity The arity of func. - * @return The new curried function. - **/ - curry( + * Creates a function that accepts one or more arguments of func that when called either invokes func returning + * its result, if all func arguments have been provided, or returns a function that accepts one or more of the + * remaining func arguments, and so on. The arity of func may be specified if func.length is not sufficient. + * @param func The function to curry. + * @param arity The arity of func. + * @return Returns the new curried function. + */ + curry( func: Function, - arity?: number): Function; + arity?: number): TResult; } interface LoDashObjectWrapper { /** * @see _.curry **/ - curry(arity?: number): LoDashObjectWrapper; + curry(arity?: number): LoDashObjectWrapper; + } + + //_.curryRight + interface LoDashStatic { + /** + * This method is like _.curry except that arguments are applied to func in the manner of _.partialRight + * instead of _.partial. + * @param func The function to curry. + * @param arity The arity of func. + * @return Returns the new curried function. + */ + curryRight( + func: Function, + arity?: number): TResult; + } + + interface LoDashObjectWrapper { + /** + * @see _.curryRight + **/ + curryRight(arity?: number): LoDashObjectWrapper; } //_.debounce