diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 87e5d9a57..30a370b66 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -5761,12 +5761,31 @@ module TestRestParam { } //_.spread -var testSpreadFn = (who: string, what: string) => who + ' says ' + what; -interface TestSpreadResultFn { - (args: string[]): string; +module TestSpread { + type SampleFunc = (args: (number|string)[]) => boolean; + type SampleResult = (a: number, b: string) => boolean; + + let func: SampleFunc; + + { + let result: SampleResult; + + result = _.spread(func); + result = _.spread(func); + } + + { + let result: _.LoDashImplicitObjectWrapper; + + result = _(func).spread(); + } + + { + let result: _.LoDashExplicitObjectWrapper; + + result = _(func).chain().spread(); + } } -result = (_.spread(testSpreadFn))(['fred', 'hello']); -result = (_(testSpreadFn).spread().value())(['fred', 'hello']); // _.throttle module TestThrottle { diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 41334d12b..599973bdd 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -9540,19 +9540,33 @@ declare module _ { /** * Creates a function that invokes func with the this binding of the created function and an array of arguments * much like Function#apply. + * + * Note: This method is based on the spread operator. + * * @param func The function to spread arguments over. * @return Returns the new function. */ - spread(func: Function): TResult; + spread(func: F): T; + + /** + * @see _.spread + */ + spread(func: Function): T; } interface LoDashImplicitObjectWrapper { /** * @see _.spread */ - spread(): LoDashImplicitObjectWrapper; + spread(): LoDashImplicitObjectWrapper; } + interface LoDashExplicitObjectWrapper { + /** + * @see _.spread + */ + spread(): LoDashExplicitObjectWrapper; + } //_.throttle interface ThrottleSettings {