mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-08-24 11:29:30 +08:00
lodash: signatures of the method _.modArgs have been changed
This commit is contained in:
+51
-18
@@ -3840,25 +3840,58 @@ var returnedMemoize = _.throttle(function (a: any) { return a * 5; }, 5);
|
||||
returnedMemoize(4);
|
||||
|
||||
// _.modArgs
|
||||
function modArgsFn1(n: number): string {return n.toString()}
|
||||
function modArgsFn2(n: boolean): string {return n.toString()}
|
||||
interface ModArgsFunc {
|
||||
(x: string, y: string): string[];
|
||||
module TestModArgs {
|
||||
type Func1 = (a: boolean) => boolean;
|
||||
type Func2 = (a: boolean, b: boolean) => boolean;
|
||||
|
||||
let func1: Func1;
|
||||
let func2: Func2;
|
||||
|
||||
let transform1: (a: string) => boolean;
|
||||
let transform2: (b: number) => boolean;
|
||||
|
||||
{
|
||||
let result: (a: string) => boolean;
|
||||
|
||||
result = _.modArgs<Func1, (a: string) => boolean>(func1, transform1);
|
||||
result = _.modArgs<Func1, (a: string) => boolean>(func1, [transform1]);
|
||||
}
|
||||
|
||||
{
|
||||
let result: (a: string, b: number) => boolean;
|
||||
|
||||
result = _.modArgs<Func2, (a: string, b: number) => boolean>(func2, transform1, transform2);
|
||||
result = _.modArgs<Func2, (a: string, b: number) => boolean>(func2, [transform1, transform2]);
|
||||
}
|
||||
|
||||
{
|
||||
let result: _.LoDashImplicitObjectWrapper<(a: string) => boolean>;
|
||||
|
||||
result = _(func1).modArgs<(a: string) => boolean>(transform1);
|
||||
result = _(func1).modArgs<(a: string) => boolean>([transform1]);
|
||||
}
|
||||
|
||||
{
|
||||
let result: _.LoDashImplicitObjectWrapper<(a: string, b: number) => boolean>;
|
||||
|
||||
result = _(func2).modArgs<(a: string, b: number) => boolean>(transform1, transform2);
|
||||
result = _(func2).modArgs<(a: string, b: number) => boolean>([transform1, transform2]);
|
||||
}
|
||||
|
||||
{
|
||||
let result: _.LoDashExplicitObjectWrapper<(a: string) => boolean>;
|
||||
|
||||
result = _(func1).chain().modArgs<(a: string) => boolean>(transform1);
|
||||
result = _(func1).chain().modArgs<(a: string) => boolean>([transform1]);
|
||||
}
|
||||
|
||||
{
|
||||
let result: _.LoDashExplicitObjectWrapper<(a: string, b: number) => boolean>;
|
||||
|
||||
result = _(func2).chain().modArgs<(a: string, b: number) => boolean>(transform1, transform2);
|
||||
result = _(func2).chain().modArgs<(a: string, b: number) => boolean>([transform1, transform2]);
|
||||
}
|
||||
}
|
||||
interface ModArgsResult {
|
||||
(x: number, y: boolean): string[]
|
||||
}
|
||||
result = <ModArgsResult>_.modArgs<ModArgsFunc, ModArgsResult>((x: string, y: string) => [x, y], modArgsFn1, modArgsFn2);
|
||||
result = <string[]>result(1, true);
|
||||
|
||||
result = <ModArgsResult>_.modArgs<ModArgsFunc, ModArgsResult>((x: string, y: string) => [x, y], [modArgsFn1, modArgsFn2]);
|
||||
result = <string[]>result(1, true);
|
||||
|
||||
result = <ModArgsResult>_<ModArgsFunc>((x: string, y: string) => [x, y]).modArgs<ModArgsResult>(modArgsFn1, modArgsFn2).value();
|
||||
result = <string[]>result(1, true);
|
||||
|
||||
result = <ModArgsResult>_<ModArgsFunc>((x: string, y: string) => [x, y]).modArgs<ModArgsResult>([modArgsFn1, modArgsFn2]).value();
|
||||
result = <string[]>result(1, true);
|
||||
|
||||
// _.negate
|
||||
interface TestNegatePredicate {
|
||||
|
||||
Vendored
+13
@@ -7557,6 +7557,7 @@ declare module _ {
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
* Creates a function that runs each argument through a corresponding transform function.
|
||||
*
|
||||
* @param func The function to wrap.
|
||||
* @param transforms The functions to transform arguments, specified as individual functions or arrays
|
||||
* of functions.
|
||||
@@ -7588,6 +7589,18 @@ declare module _ {
|
||||
modArgs<TResult extends Function>(transforms: Function[]): LoDashImplicitObjectWrapper<TResult>;
|
||||
}
|
||||
|
||||
interface LoDashExplicitObjectWrapper<T> {
|
||||
/**
|
||||
* @see _.modArgs
|
||||
*/
|
||||
modArgs<TResult extends Function>(...transforms: Function[]): LoDashExplicitObjectWrapper<TResult>;
|
||||
|
||||
/**
|
||||
* @see _.modArgs
|
||||
*/
|
||||
modArgs<TResult extends Function>(transforms: Function[]): LoDashExplicitObjectWrapper<TResult>;
|
||||
}
|
||||
|
||||
//_.negate
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user