mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-12 21:10:23 +00:00
lodash: added _.callback() method (alias iteratee)
This commit is contained in:
+49
-3
@@ -1941,9 +1941,32 @@ result = <string[]>_.words('fred, barney, & pebbles', /[^, ]+/g);
|
||||
result = <string[]>_('fred, barney, & pebbles').words();
|
||||
result = <string[]>_('fred, barney, & pebbles').words(/[^, ]+/g);
|
||||
|
||||
/**********
|
||||
* Utilities *
|
||||
***********/
|
||||
/***********
|
||||
* Utility *
|
||||
***********/
|
||||
|
||||
// _.callback
|
||||
{
|
||||
let result: (...args: any[]) => TResult;
|
||||
result = _.callback<TResult>(Function);
|
||||
result = _.callback<TResult>(Function, any);
|
||||
result = _(Function).callback<TResult>().value();
|
||||
result = _(Function).callback<TResult>(any).value();
|
||||
}
|
||||
{
|
||||
let result: (object: any) => TResult;
|
||||
result = _.callback<TResult>('');
|
||||
result = _.callback<TResult>('', any);
|
||||
result = _('').callback<TResult>().value();
|
||||
result = _('').callback<TResult>(any).value();
|
||||
}
|
||||
{
|
||||
let result: (object: any) => boolean;
|
||||
result = _.callback({});
|
||||
result = _.callback({}, any);
|
||||
result = _({}).callback().value();
|
||||
result = _({}).callback(any).value();
|
||||
}
|
||||
|
||||
// _.constant
|
||||
result = <() => number>_.constant<number>(1);
|
||||
@@ -1973,6 +1996,29 @@ result = <() => {}>_({}).constant<{}>();
|
||||
result = _<boolean>([]).identity();
|
||||
}
|
||||
|
||||
// _.iteratee
|
||||
{
|
||||
let result: (...args: any[]) => TResult;
|
||||
result = _.iteratee<TResult>(Function);
|
||||
result = _.iteratee<TResult>(Function, any);
|
||||
result = _(Function).iteratee<TResult>().value();
|
||||
result = _(Function).iteratee<TResult>(any).value();
|
||||
}
|
||||
{
|
||||
let result: (object: any) => TResult;
|
||||
result = _.iteratee<TResult>('');
|
||||
result = _.iteratee<TResult>('', any);
|
||||
result = _('').iteratee<TResult>().value();
|
||||
result = _('').iteratee<TResult>(any).value();
|
||||
}
|
||||
{
|
||||
let result: (object: any) => boolean;
|
||||
result = _.iteratee({});
|
||||
result = _.iteratee({}, any);
|
||||
result = _({}).iteratee().value();
|
||||
result = _({}).iteratee(any).value();
|
||||
}
|
||||
|
||||
// _.method
|
||||
class TestMethod {
|
||||
a = {
|
||||
|
||||
Vendored
+109
@@ -8117,6 +8117,64 @@ declare module _ {
|
||||
attempt<TResult>(): TResult|Error;
|
||||
}
|
||||
|
||||
//_.callback
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
* Creates a function that invokes func with the this binding of thisArg and arguments of the created function.
|
||||
* If func is a property name the created callback returns the property value for a given element. If func is
|
||||
* an object the created callback returns true for elements that contain the equivalent object properties,
|
||||
* otherwise it returns false.
|
||||
*
|
||||
* @param func The value to convert to a callback.
|
||||
* @param thisArg The this binding of func.
|
||||
* @result Returns the callback.
|
||||
*/
|
||||
callback<TResult>(
|
||||
func: Function,
|
||||
thisArg?: any
|
||||
): (...args: any[]) => TResult;
|
||||
|
||||
/**
|
||||
* @see _.callback
|
||||
*/
|
||||
callback<TResult>(
|
||||
func: string,
|
||||
thisArg?: any
|
||||
): (object: any) => TResult;
|
||||
|
||||
/**
|
||||
* @see _.callback
|
||||
*/
|
||||
callback(
|
||||
func: Object,
|
||||
thisArg?: any
|
||||
): (object: any) => boolean;
|
||||
|
||||
/**
|
||||
* @see _.callback
|
||||
*/
|
||||
callback<TResult>(): (value: TResult) => TResult;
|
||||
}
|
||||
|
||||
interface LoDashWrapper<T> {
|
||||
/**
|
||||
* @see _.callback
|
||||
*/
|
||||
callback<TResult>(thisArg?: any): LoDashObjectWrapper<(object: any) => TResult>;
|
||||
}
|
||||
|
||||
interface LoDashObjectWrapper<T> {
|
||||
/**
|
||||
* @see _.callback
|
||||
*/
|
||||
callback(thisArg?: any): LoDashObjectWrapper<(object: any) => boolean>;
|
||||
|
||||
/**
|
||||
* @see _.callback
|
||||
*/
|
||||
callback<TResult>(thisArg?: any): LoDashObjectWrapper<(...args: any[]) => TResult>;
|
||||
}
|
||||
|
||||
//_.identity
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
@@ -8148,6 +8206,57 @@ declare module _ {
|
||||
identity(): T;
|
||||
}
|
||||
|
||||
//_.iteratee
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
* @see _.callback
|
||||
*/
|
||||
iteratee<TResult>(
|
||||
func: Function,
|
||||
thisArg?: any
|
||||
): (...args: any[]) => TResult;
|
||||
|
||||
/**
|
||||
* @see _.callback
|
||||
*/
|
||||
iteratee<TResult>(
|
||||
func: string,
|
||||
thisArg?: any
|
||||
): (object: any) => TResult;
|
||||
|
||||
/**
|
||||
* @see _.callback
|
||||
*/
|
||||
iteratee(
|
||||
func: Object,
|
||||
thisArg?: any
|
||||
): (object: any) => boolean;
|
||||
|
||||
/**
|
||||
* @see _.callback
|
||||
*/
|
||||
iteratee<TResult>(): (value: TResult) => TResult;
|
||||
}
|
||||
|
||||
interface LoDashWrapper<T> {
|
||||
/**
|
||||
* @see _.callback
|
||||
*/
|
||||
iteratee<TResult>(thisArg?: any): LoDashObjectWrapper<(object: any) => TResult>;
|
||||
}
|
||||
|
||||
interface LoDashObjectWrapper<T> {
|
||||
/**
|
||||
* @see _.callback
|
||||
*/
|
||||
iteratee(thisArg?: any): LoDashObjectWrapper<(object: any) => boolean>;
|
||||
|
||||
/**
|
||||
* @see _.callback
|
||||
*/
|
||||
iteratee<TResult>(thisArg?: any): LoDashObjectWrapper<(...args: any[]) => TResult>;
|
||||
}
|
||||
|
||||
//_.method
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user