diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 4c587b57b..8d76279ce 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -5458,8 +5458,46 @@ result = _({ 'name': 'moe', 'age': 40 }).omit(function (value) { return typeof value == 'number'; }).value(); -result = _.pairs({ 'moe': 30, 'larry': 40 }); -result = _({ 'moe': 30, 'larry': 40 }).pairs().value(); +// _.pairs +module TestPairs { + let object: _.Dictionary; + + { + let result: any[][]; + + result = _.pairs<_.Dictionary>(object); + } + + { + let result: string[][]; + + result = _.pairs<_.Dictionary, string>(object); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(object).pairs(); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(object).pairs(); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(object).chain().pairs(); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(object).chain().pairs(); + } +} // _.pick interface TestPickFn { diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 98d8bf55d..5dddacce8 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -10518,19 +10518,28 @@ declare module _ { //_.pairs interface LoDashStatic { /** - * Creates a two dimensional array of an object's key-value pairs, - * i.e. [[key1, value1], [key2, value2]]. - * @param object The object to inspect. - * @return Aew array of key-value pairs. - **/ - pairs(object?: any): any[][]; + * Creates a two dimensional array of the key-value pairs for object, e.g. [[key1, value1], [key2, value2]]. + * + * @param object The object to query. + * @return Returns the new array of key-value pairs. + */ + pairs(object?: T): any[][]; + + pairs(object?: T): TResult[][]; } interface LoDashImplicitObjectWrapper { /** - * @see _.pairs - **/ - pairs(): LoDashImplicitArrayWrapper; + * @see _.pairs + */ + pairs(): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.pairs + */ + pairs(): LoDashExplicitArrayWrapper; } //_.pick