mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
lodash: signatures of _.spread have been changed
This commit is contained in:
+24
-5
@@ -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<SampleFunc, SampleResult>(func);
|
||||
result = _.spread<SampleResult>(func);
|
||||
}
|
||||
|
||||
{
|
||||
let result: _.LoDashImplicitObjectWrapper<SampleResult>;
|
||||
|
||||
result = _(func).spread<SampleResult>();
|
||||
}
|
||||
|
||||
{
|
||||
let result: _.LoDashExplicitObjectWrapper<SampleResult>;
|
||||
|
||||
result = _(func).chain().spread<SampleResult>();
|
||||
}
|
||||
}
|
||||
result = <string>(_.spread<TestSpreadResultFn>(testSpreadFn))(['fred', 'hello']);
|
||||
result = <string>(_(testSpreadFn).spread<TestSpreadResultFn>().value())(['fred', 'hello']);
|
||||
|
||||
// _.throttle
|
||||
module TestThrottle {
|
||||
|
||||
Vendored
+16
-2
@@ -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<TResult extends Function>(func: Function): TResult;
|
||||
spread<F extends Function, T extends Function>(func: F): T;
|
||||
|
||||
/**
|
||||
* @see _.spread
|
||||
*/
|
||||
spread<T extends Function>(func: Function): T;
|
||||
}
|
||||
|
||||
interface LoDashImplicitObjectWrapper<T> {
|
||||
/**
|
||||
* @see _.spread
|
||||
*/
|
||||
spread<TResult extends Function>(): LoDashImplicitObjectWrapper<TResult>;
|
||||
spread<T extends Function>(): LoDashImplicitObjectWrapper<T>;
|
||||
}
|
||||
|
||||
interface LoDashExplicitObjectWrapper<T> {
|
||||
/**
|
||||
* @see _.spread
|
||||
*/
|
||||
spread<T extends Function>(): LoDashExplicitObjectWrapper<T>;
|
||||
}
|
||||
|
||||
//_.throttle
|
||||
interface ThrottleSettings {
|
||||
|
||||
Reference in New Issue
Block a user