From 6825bb501f9b2945af3597627610221c0de9827d Mon Sep 17 00:00:00 2001 From: Ilya Mochalov Date: Fri, 20 Nov 2015 03:57:02 +0500 Subject: [PATCH] lodash: sugnatures of _.zip have been changed --- lodash/lodash-tests.ts | 39 +++++++++++++++++++++++++++++++++-- lodash/lodash.d.ts | 46 ++++++++++++++++++++++++++++-------------- 2 files changed, 68 insertions(+), 17 deletions(-) diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 6d047d3d0..fbe3f7c95 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -1615,8 +1615,43 @@ module TestXor { } } -result = _.zip(['moe', 'larry'], [30, 40], [true, false]); -result = _(['moe', 'larry']).zip([30, 40], [true, false]).value(); +// _.zip +module TestZip { + let array: TResult[]; + let list: _.List; + + { + let result: TResult[][]; + + result = _.zip(array); + result = _.zip(array, list); + result = _.zip(array, list, array); + + result = _.zip(list); + result = _.zip(list, array); + result = _.zip(list, array, list); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(array).zip(list); + result = _(array).zip(list, array); + + result = _(list).zip(array); + result = _(list).zip(array, list); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(array).chain().zip(list); + result = _(array).chain().zip(list, array); + + result = _(list).chain().zip(array); + result = _(list).chain().zip(array, list); + } +} // _.zipObject module TestZipObject { diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index e4e027fba..ad26b7a08 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -2931,25 +2931,41 @@ declare module _ { //_.zip interface LoDashStatic { /** - * Creates an array of grouped elements, the first of which contains the first - * elements of the given arrays, the second of which contains the second elements - * of the given arrays, and so on. - * @param arrays Arrays to process. - * @return A new array of grouped elements. - **/ - zip(...arrays: any[][]): any[][]; - - /** - * @see _.zip - **/ - zip(...arrays: any[]): any[]; + * Creates an array of grouped elements, the first of which contains the first elements of the given arrays, + * the second of which contains the second elements of the given arrays, and so on. + * + * @param arrays The arrays to process. + * @return Returns the new array of grouped elements. + */ + zip(...arrays: List[]): T[][]; } interface LoDashImplicitArrayWrapper { /** - * @see _.zip - **/ - zip(...arrays: any[][]): _.LoDashImplicitArrayWrapper; + * @see _.zip + */ + zip(...arrays: List[]): _.LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.zip + */ + zip(...arrays: List[]): _.LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.zip + */ + zip(...arrays: List[]): _.LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.zip + */ + zip(...arrays: List[]): _.LoDashExplicitArrayWrapper; } //_.zipObject