From be440624b6d83889530547db0266d128a65a204b Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Fri, 1 Jan 2016 13:22:59 +0500 Subject: [PATCH] lodash: signatures of _.spread have been changed --- lodash/lodash-tests.ts | 29 ++++++++++++++++++++++++----- lodash/lodash.d.ts | 18 ++++++++++++++++-- 2 files changed, 40 insertions(+), 7 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 77a20e2e2..8630a049f 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -5525,12 +5525,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 c45ec90ee..a9daac2b9 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -9405,19 +9405,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 {