diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index fbef1d495..332f7f3a4 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -5972,13 +5972,48 @@ module TestForIn { } } -result = _.forInRight(new Dog('Dagny'), function (value, key) { - console.log(key); -}); +// _.forInRight +module TestForInRight { + type SampleObject = {a: number; b: string; c: boolean;}; -result = <_.LoDashImplicitObjectWrapper>_(new Dog('Dagny')).forInRight(function (value, key) { - console.log(key); -}); + let dictionary: _.Dictionary; + let dictionaryIterator: (value: number, key: string, collection: _.Dictionary) => any; + + let object: SampleObject; + let objectIterator: (element: any, key?: string, collection?: any) => any; + + { + let result: _.Dictionary; + + result = _.forInRight(dictionary); + result = _.forInRight(dictionary, dictionaryIterator); + result = _.forInRight(dictionary, dictionaryIterator, any); + } + + { + let result: SampleObject; + + result = _.forInRight(object); + result = _.forInRight(object, objectIterator); + result = _.forInRight(object, objectIterator, any); + } + + { + let result: _.LoDashImplicitObjectWrapper<_.Dictionary>; + + result = _(dictionary).forInRight(); + result = _(dictionary).forInRight(dictionaryIterator); + result = _(dictionary).forInRight(dictionaryIterator, any); + } + + { + let result: _.LoDashExplicitObjectWrapper<_.Dictionary>; + + result = _(dictionary).chain().forInRight(); + result = _(dictionary).chain().forInRight(dictionaryIterator); + result = _(dictionary).chain().forInRight(dictionaryIterator, any); + } +} // _.forOwn module TestForOwn { diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 91dadb85f..5b2e832a3 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -10439,34 +10439,47 @@ declare module _ { //_.forInRight interface LoDashStatic { /** - * This method is like _.forIn 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 - **/ - forInRight( + * This method is like _.forIn 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. + */ + forInRight( object: Dictionary, - callback?: DictionaryIterator, - thisArg?: any): Dictionary; + iteratee?: DictionaryIterator, + thisArg?: any + ): Dictionary; /** - * @see _.forInRight - **/ + * @see _.forInRight + */ forInRight( object: T, - callback?: ObjectIterator, - thisArg?: any): T; + iteratee?: ObjectIterator, + thisArg?: any + ): T; } interface LoDashImplicitObjectWrapper { /** - * @see _.forInRight - **/ - forInRight( - callback: ObjectIterator, - thisArg?: any): _.LoDashImplicitObjectWrapper; + * @see _.forInRight + */ + forInRight( + iteratee?: DictionaryIterator, + thisArg?: any + ): _.LoDashImplicitObjectWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.forInRight + */ + forInRight( + iteratee?: DictionaryIterator, + thisArg?: any + ): _.LoDashExplicitObjectWrapper; } //_.forOwn