mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
lodash: signatures of the method _.restParam have been changed
This commit is contained in:
+30
-10
@@ -3927,17 +3927,37 @@ result = <string[]>(_.rearg<TestReargResultFn>(testReargFn, [2, 0, 1]))('b', 'c'
|
||||
result = <string[]>(_(testReargFn).rearg<TestReargResultFn>(2, 0, 1).value())('b', 'c', 'a');
|
||||
result = <string[]>(_(testReargFn).rearg<TestReargResultFn>([2, 0, 1]).value())('b', 'c', 'a');
|
||||
|
||||
//_.restParam
|
||||
var testRestParamFn = (a: string, b: string, c: number[]) => a + ' ' + b + ' ' + c.join(' ');
|
||||
interface testRestParamFunc {
|
||||
(a: string, b: string, c: number[]): string;
|
||||
// _.restParam
|
||||
module TestRestParam {
|
||||
type Func = (a: string, b: number[]) => boolean;
|
||||
type ResultFunc = (a: string, ...b: number[]) => boolean;
|
||||
|
||||
let func: Func;
|
||||
|
||||
{
|
||||
let result: ResultFunc;
|
||||
|
||||
result = _.restParam<ResultFunc>(func);
|
||||
result = _.restParam<ResultFunc>(func, 1);
|
||||
|
||||
result = _.restParam<ResultFunc, Func>(func);
|
||||
result = _.restParam<ResultFunc, Func>(func, 1);
|
||||
}
|
||||
|
||||
{
|
||||
let result: _.LoDashImplicitObjectWrapper<ResultFunc>;
|
||||
|
||||
result = _(func).restParam<ResultFunc>();
|
||||
result = _(func).restParam<ResultFunc>(1);
|
||||
}
|
||||
|
||||
{
|
||||
let result: _.LoDashExplicitObjectWrapper<ResultFunc>;
|
||||
|
||||
result = _(func).chain().restParam<ResultFunc>();
|
||||
result = _(func).chain().restParam<ResultFunc>(1);
|
||||
}
|
||||
}
|
||||
interface testRestParamResult {
|
||||
(a: string, b: string, ...c: number[]): string;
|
||||
}
|
||||
result = <string>(_.restParam<testRestParamResult, testRestParamFunc>(testRestParamFn, 2))('a', 'b', 1, 2, 3);
|
||||
result = <string>(_.restParam<testRestParamResult>(testRestParamFn, 2))('a', 'b', 1, 2, 3);
|
||||
result = <string>(_(testRestParamFn).restParam<testRestParamResult>(2).value())('a', 'b', 1, 2, 3);
|
||||
|
||||
//_.spread
|
||||
var testSpreadFn = (who: string, what: string) => who + ' says ' + what;
|
||||
|
||||
Vendored
+18
-2
@@ -7802,16 +7802,25 @@ declare module _ {
|
||||
/**
|
||||
* Creates a function that invokes func with the this binding of the created function and arguments from start
|
||||
* and beyond provided as an array.
|
||||
*
|
||||
* Note: This method is based on the rest parameter.
|
||||
*
|
||||
* @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<TResult extends Function>(func: Function, start?: number): TResult;
|
||||
restParam<TResult extends Function>(
|
||||
func: Function,
|
||||
start?: number
|
||||
): TResult;
|
||||
|
||||
/**
|
||||
* @see _.restParam
|
||||
*/
|
||||
restParam<TResult extends Function, TFunc extends Function>(func: TFunc, start?: number): TResult;
|
||||
restParam<TResult extends Function, TFunc extends Function>(
|
||||
func: TFunc,
|
||||
start?: number
|
||||
): TResult;
|
||||
}
|
||||
|
||||
interface LoDashImplicitObjectWrapper<T> {
|
||||
@@ -7821,6 +7830,13 @@ declare module _ {
|
||||
restParam<TResult extends Function>(start?: number): LoDashImplicitObjectWrapper<TResult>;
|
||||
}
|
||||
|
||||
interface LoDashExplicitObjectWrapper<T> {
|
||||
/**
|
||||
* @see _.restParam
|
||||
*/
|
||||
restParam<TResult extends Function>(start?: number): LoDashExplicitObjectWrapper<TResult>;
|
||||
}
|
||||
|
||||
//_.spread
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user