mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
Add chainable definitions for _(...).forEach and aliases when passing an non-dictionary object.
This commit is contained in:
@@ -397,9 +397,11 @@ result = <IFoodCombined>_.findLast(foodsCombined, 'organic');
|
||||
|
||||
result = <number[]>_.forEach([1, 2, 3], function (num) { console.log(num); });
|
||||
result = <_.Dictionary<number>>_.forEach({ 'one': 1, 'two': 2, 'three': 3 }, function (num) { console.log(num); });
|
||||
result = <IFoodType>_.forEach<IFoodType, string>({ name: 'apple', type: 'fruit' }, function (value, key) { console.log(value, key) });
|
||||
|
||||
result = <number[]>_.each([1, 2, 3], function (num) { console.log(num); });
|
||||
result = <_.Dictionary<number>>_.each({ 'one': 1, 'two': 2, 'three': 3 }, function (num) { console.log(num); });
|
||||
result = <IFoodType>_.each<IFoodType, string>({ name: 'apple', type: 'fruit' }, function (value, key) { console.log(value, key) });
|
||||
|
||||
result = <_.LoDashArrayWrapper<number>>_([1, 2, 3]).forEach(function (num) { console.log(num); });
|
||||
result = <_.LoDashObjectWrapper<_.Dictionary<number>>>_(<{ [index: string]: number; }>{ 'one': 1, 'two': 2, 'three': 3 }).forEach(function (num) { console.log(num); });
|
||||
|
||||
Vendored
+16
@@ -2939,6 +2939,14 @@ declare module _ {
|
||||
callback: ObjectIterator<T, void>,
|
||||
thisArg?: any): Dictionary<T>;
|
||||
|
||||
/**
|
||||
* @see _.each
|
||||
**/
|
||||
forEach<T extends {}, TValue>(
|
||||
object: T,
|
||||
callback: ObjectIterator<TValue, void>,
|
||||
thisArg?: any): T
|
||||
|
||||
/**
|
||||
* @see _.forEach
|
||||
**/
|
||||
@@ -2965,6 +2973,14 @@ declare module _ {
|
||||
object: Dictionary<T>,
|
||||
callback: ObjectIterator<T, void>,
|
||||
thisArg?: any): Dictionary<T>;
|
||||
|
||||
/**
|
||||
* @see _.each
|
||||
**/
|
||||
each<T extends {}, TValue>(
|
||||
object: T,
|
||||
callback: ObjectIterator<TValue, void>,
|
||||
thisArg?: any): T
|
||||
}
|
||||
|
||||
interface LoDashArrayWrapper<T> {
|
||||
|
||||
Reference in New Issue
Block a user