diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index d2f7dd5c7..30c0b9934 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -1640,8 +1640,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 6bc702cea..73a783b64 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -2945,25 +2945,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