From b3652b2edb47443c2850851926c11619b5e9b853 Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Mon, 16 Nov 2015 22:27:37 +0500 Subject: [PATCH] lodash: signatures of the method _.forInRight have been changed --- lodash/lodash-tests.ts | 47 +++++++++++++++++++++++++++++++++----- lodash/lodash.d.ts | 51 ++++++++++++++++++++++++++---------------- 2 files changed, 73 insertions(+), 25 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 85020b5df..f523b8c00 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 e1216dd47..cd7c153a6 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