diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 75432eaa1f..4f84b49380 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -973,6 +973,18 @@ var optionsPartialRight = { defaultsDeep(optionsPartialRight, _.templateSettings); +//_.restParam +var testRestParamFn = (a: string, b: string, c: number[]) => a + ' ' + b + ' ' + c.join(' '); +interface testRestParamFunc { + (a: string, b: string, c: number[]): string; +} +interface testRestParamResult { + (a: string, b: string, ...c: number[]): string; +} +result = (_.restParam(testRestParamFn, 2))('a', 'b', 1, 2, 3); +result = (_.restParam(testRestParamFn, 2))('a', 'b', 1, 2, 3); +result = (_(testRestParamFn).restParam(2).value())('a', 'b', 1, 2, 3); + var throttled = _.throttle(function () { }, 100); jQuery(window).on('scroll', throttled); diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 283d16adce..53447ed4ab 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -5634,6 +5634,30 @@ declare module _ { ...args: any[]): Function; } + //_.restParam + interface LoDashStatic { + /** + * Creates a function that invokes func with the this binding of the created function and arguments from start + * and beyond provided as an array. + * @param func The function to apply a rest parameter to. + * @param start The start position of the rest parameter. + * @return Returns the new function. + */ + restParam(func: Function, start?: number): TResult; + + /** + * @see _.restParam + */ + restParam(func: TFunc, start?: number): TResult; + } + + interface LoDashObjectWrapper { + /** + * @see _.restParam + */ + restParam(start?: number): LoDashObjectWrapper; + } + //_.throttle interface LoDashStatic { /**