mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-08-24 11:29:30 +08:00
lodash: signatures of the method _.forIn have been changed
This commit is contained in:
+41
-6
@@ -5259,13 +5259,48 @@ module TestFindLastKey {
|
||||
}
|
||||
}
|
||||
|
||||
result = <Dog>_.forIn(new Dog('Dagny'), function (value, key) {
|
||||
console.log(key);
|
||||
});
|
||||
// _.forIn
|
||||
module TestForIn {
|
||||
type SampleObject = {a: number; b: string; c: boolean;};
|
||||
|
||||
result = <_.LoDashImplicitObjectWrapper<Dog>>_(new Dog('Dagny')).forIn(function (value, key) {
|
||||
console.log(key);
|
||||
});
|
||||
let dictionary: _.Dictionary<number>;
|
||||
let dictionaryIterator: (value: number, key: string, collection: _.Dictionary<number>) => any;
|
||||
|
||||
let object: SampleObject;
|
||||
let objectIterator: (element: any, key?: string, collection?: any) => any;
|
||||
|
||||
{
|
||||
let result: _.Dictionary<number>;
|
||||
|
||||
result = _.forIn<number>(dictionary);
|
||||
result = _.forIn<number>(dictionary, dictionaryIterator);
|
||||
result = _.forIn<number>(dictionary, dictionaryIterator, any);
|
||||
}
|
||||
|
||||
{
|
||||
let result: SampleObject;
|
||||
|
||||
result = _.forIn<SampleObject>(object);
|
||||
result = _.forIn<SampleObject>(object, objectIterator);
|
||||
result = _.forIn<SampleObject>(object, objectIterator, any);
|
||||
}
|
||||
|
||||
{
|
||||
let result: _.LoDashImplicitObjectWrapper<_.Dictionary<number>>;
|
||||
|
||||
result = _(dictionary).forIn<number>();
|
||||
result = _(dictionary).forIn<number>(dictionaryIterator);
|
||||
result = _(dictionary).forIn<number>(dictionaryIterator, any);
|
||||
}
|
||||
|
||||
{
|
||||
let result: _.LoDashExplicitObjectWrapper<_.Dictionary<number>>;
|
||||
|
||||
result = _(dictionary).chain().forIn<number>();
|
||||
result = _(dictionary).chain().forIn<number>(dictionaryIterator);
|
||||
result = _(dictionary).chain().forIn<number>(dictionaryIterator, any);
|
||||
}
|
||||
}
|
||||
|
||||
result = <Dog>_.forInRight(new Dog('Dagny'), function (value, key) {
|
||||
console.log(key);
|
||||
|
||||
Vendored
+34
-20
@@ -9936,35 +9936,49 @@ declare module _ {
|
||||
//_.forIn
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
* Iterates over own and inherited enumerable properties of an object, executing the callback for
|
||||
* each property. The callback is bound to thisArg and invoked with three arguments; (value, key,
|
||||
* object). Callbacks may exit iteration early by explicitly returning false.
|
||||
* @param object The object to iterate over.
|
||||
* @param callback The function called per iteration.
|
||||
* @param thisArg The this binding of callback.
|
||||
* @return object
|
||||
**/
|
||||
* Iterates over own and inherited enumerable properties of an object invoking iteratee for each property. The
|
||||
* iteratee is bound to thisArg and invoked with three arguments: (value, key, object). Iteratee functions may
|
||||
* exit iteration early by explicitly returning false.
|
||||
*
|
||||
* @param object The object to iterate over.
|
||||
* @param iteratee The function invoked per iteration.
|
||||
* @param thisArg The this binding of iteratee.
|
||||
* @return Returns object.
|
||||
*/
|
||||
forIn<T>(
|
||||
object: Dictionary<T>,
|
||||
callback?: DictionaryIterator<T, void>,
|
||||
thisArg?: any): Dictionary<T>;
|
||||
iteratee?: DictionaryIterator<T, any>,
|
||||
thisArg?: any
|
||||
): Dictionary<T>;
|
||||
|
||||
/**
|
||||
* @see _.forIn
|
||||
**/
|
||||
forIn<T>(
|
||||
* @see _.forIn
|
||||
*/
|
||||
forIn<T extends {}>(
|
||||
object: T,
|
||||
callback?: ObjectIterator<any, void>,
|
||||
thisArg?: any): T;
|
||||
iteratee?: ObjectIterator<any, any>,
|
||||
thisArg?: any
|
||||
): T;
|
||||
}
|
||||
|
||||
interface LoDashImplicitObjectWrapper<T> {
|
||||
/**
|
||||
* @see _.forIn
|
||||
**/
|
||||
forIn<T extends {}>(
|
||||
callback: ObjectIterator<T, void>,
|
||||
thisArg?: any): _.LoDashImplicitObjectWrapper<T>;
|
||||
* @see _.forIn
|
||||
*/
|
||||
forIn<TValue>(
|
||||
iteratee?: DictionaryIterator<TValue, any>,
|
||||
thisArg?: any
|
||||
): _.LoDashImplicitObjectWrapper<T>;
|
||||
}
|
||||
|
||||
interface LoDashExplicitObjectWrapper<T> {
|
||||
/**
|
||||
* @see _.forIn
|
||||
*/
|
||||
forIn<TValue>(
|
||||
iteratee?: DictionaryIterator<TValue, any>,
|
||||
thisArg?: any
|
||||
): _.LoDashExplicitObjectWrapper<T>;
|
||||
}
|
||||
|
||||
//_.forInRight
|
||||
|
||||
Reference in New Issue
Block a user