diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 364bc0ec2b..a64986f7aa 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -999,6 +999,14 @@ result = (_.restParam(testRestPa result = (_.restParam(testRestParamFn, 2))('a', 'b', 1, 2, 3); result = (_(testRestParamFn).restParam(2).value())('a', 'b', 1, 2, 3); +//_.spread +var testSpreadFn = (who: string, what: string) => who + ' says ' + what; +interface TestSpreadResultFn { + (args: string[]): string; +} +result = (_.spread(testSpreadFn))(['fred', 'hello']); +result = (_(testSpreadFn).spread().value())(['fred', 'hello']); + var throttled = _.throttle(function () { }, 100); jQuery(window).on('scroll', throttled); diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 225e6bc6c0..1ab5a00608 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -5708,6 +5708,25 @@ declare module _ { restParam(start?: number): LoDashObjectWrapper; } + //_.spread + interface LoDashStatic { + /** + * Creates a function that invokes func with the this binding of the created function and an array of arguments + * much like Function#apply. + * @param func The function to spread arguments over. + * @return Returns the new function. + */ + spread(func: Function): TResult; + } + + interface LoDashObjectWrapper { + /** + * @see _.spread + */ + spread(): LoDashObjectWrapper; + } + + //_.throttle interface LoDashStatic { /**