mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-08-24 11:29:30 +08:00
Merge pull request #6808 from chrootsu/lodash-forOwnRight
lodash: signatures of the method _.forOwnRight have been changed
This commit is contained in:
+41
-12
@@ -6072,20 +6072,49 @@ module TestForOwn {
|
||||
}
|
||||
}
|
||||
|
||||
interface ZeroOne {
|
||||
0: string;
|
||||
1: string;
|
||||
one: string;
|
||||
// _.forOwnRight
|
||||
module TestForOwnRight {
|
||||
type SampleObject = {a: number; b: string; c: boolean;};
|
||||
|
||||
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 = _.forOwnRight<number>(dictionary);
|
||||
result = _.forOwnRight<number>(dictionary, dictionaryIterator);
|
||||
result = _.forOwnRight<number>(dictionary, dictionaryIterator, any);
|
||||
}
|
||||
|
||||
{
|
||||
let result: SampleObject;
|
||||
|
||||
result = _.forOwnRight<SampleObject>(object);
|
||||
result = _.forOwnRight<SampleObject>(object, objectIterator);
|
||||
result = _.forOwnRight<SampleObject>(object, objectIterator, any);
|
||||
}
|
||||
|
||||
{
|
||||
let result: _.LoDashImplicitObjectWrapper<_.Dictionary<number>>;
|
||||
|
||||
result = _(dictionary).forOwnRight<number>();
|
||||
result = _(dictionary).forOwnRight<number>(dictionaryIterator);
|
||||
result = _(dictionary).forOwnRight<number>(dictionaryIterator, any);
|
||||
}
|
||||
|
||||
{
|
||||
let result: _.LoDashExplicitObjectWrapper<_.Dictionary<number>>;
|
||||
|
||||
result = _(dictionary).chain().forOwnRight<number>();
|
||||
result = _(dictionary).chain().forOwnRight<number>(dictionaryIterator);
|
||||
result = _(dictionary).chain().forOwnRight<number>(dictionaryIterator, any);
|
||||
}
|
||||
}
|
||||
|
||||
result = <any>_.forOwnRight({ '0': 'zero', '1': 'one', 'length': 2 }, function (num, key) {
|
||||
console.log(key);
|
||||
});
|
||||
|
||||
result = <_.LoDashImplicitObjectWrapper<ZeroOne>>_({ '0': 'zero', '1': 'one', 'length': 2 }).forOwnRight(function (num, key) {
|
||||
console.log(key);
|
||||
});
|
||||
|
||||
// _.functions
|
||||
module TestFunctions {
|
||||
type SampleObject = {a: number; b: string; c: boolean;};
|
||||
|
||||
Vendored
+33
-19
@@ -10544,33 +10544,47 @@ declare module _ {
|
||||
//_.forOwnRight
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
* This method is like _.forOwn except that it iterates over elements of a collection in the
|
||||
* opposite order.
|
||||
* @param object The object to iterate over.
|
||||
* @param callback The function called per iteration.
|
||||
* @param thisArg The this binding of callback.
|
||||
* @return object
|
||||
**/
|
||||
forOwnRight<T extends {}>(
|
||||
* This method is like _.forOwn except that it iterates over properties of object in the opposite order.
|
||||
*
|
||||
* @param object The object to iterate over.
|
||||
* @param iteratee The function invoked per iteration.
|
||||
* @param thisArg The this binding of iteratee.
|
||||
* @return Returns object.
|
||||
*/
|
||||
forOwnRight<T>(
|
||||
object: Dictionary<T>,
|
||||
callback?: DictionaryIterator<T, void>,
|
||||
thisArg?: any): Dictionary<T>;
|
||||
iteratee?: DictionaryIterator<T, any>,
|
||||
thisArg?: any
|
||||
): Dictionary<T>;
|
||||
|
||||
/**
|
||||
* @see _.forOwnRight
|
||||
**/
|
||||
* @see _.forOwnRight
|
||||
*/
|
||||
forOwnRight<T extends {}>(
|
||||
object: T,
|
||||
callback?: ObjectIterator<any, void>,
|
||||
thisArg?: any): T;
|
||||
iteratee?: ObjectIterator<any, any>,
|
||||
thisArg?: any
|
||||
): T;
|
||||
}
|
||||
|
||||
interface LoDashImplicitObjectWrapper<T> {
|
||||
/**
|
||||
* @see _.forOwnRight
|
||||
**/
|
||||
forOwnRight<T extends {}>(
|
||||
callback: ObjectIterator<T, void>,
|
||||
thisArg?: any): _.LoDashImplicitObjectWrapper<T>;
|
||||
* @see _.forOwnRight
|
||||
*/
|
||||
forOwnRight<TValue>(
|
||||
iteratee?: DictionaryIterator<TValue, any>,
|
||||
thisArg?: any
|
||||
): _.LoDashImplicitObjectWrapper<T>;
|
||||
}
|
||||
|
||||
interface LoDashExplicitObjectWrapper<T> {
|
||||
/**
|
||||
* @see _.forOwnRight
|
||||
*/
|
||||
forOwnRight<TValue>(
|
||||
iteratee?: DictionaryIterator<TValue, any>,
|
||||
thisArg?: any
|
||||
): _.LoDashExplicitObjectWrapper<T>;
|
||||
}
|
||||
|
||||
//_.functions
|
||||
|
||||
Reference in New Issue
Block a user