Skip to content

Commit 6825bb5

Browse files
committed
lodash: sugnatures of _.zip have been changed
1 parent 16134c1 commit 6825bb5

File tree

2 files changed

+67
-16
lines changed

2 files changed

+67
-16
lines changed

lodash/lodash-tests.ts

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1615,8 +1615,43 @@ module TestXor {
16151615
}
16161616
}
16171617

1618-
result = <any[][]>_.zip(['moe', 'larry'], [30, 40], [true, false]);
1619-
result = <any[][]>_(['moe', 'larry']).zip([30, 40], [true, false]).value();
1618+
// _.zip
1619+
module TestZip {
1620+
let array: TResult[];
1621+
let list: _.List<TResult>;
1622+
1623+
{
1624+
let result: TResult[][];
1625+
1626+
result = _.zip<TResult>(array);
1627+
result = _.zip<TResult>(array, list);
1628+
result = _.zip<TResult>(array, list, array);
1629+
1630+
result = _.zip<TResult>(list);
1631+
result = _.zip<TResult>(list, array);
1632+
result = _.zip<TResult>(list, array, list);
1633+
}
1634+
1635+
{
1636+
let result: _.LoDashImplicitArrayWrapper<TResult[]>;
1637+
1638+
result = _(array).zip<TResult>(list);
1639+
result = _(array).zip<TResult>(list, array);
1640+
1641+
result = _(list).zip<TResult>(array);
1642+
result = _(list).zip<TResult>(array, list);
1643+
}
1644+
1645+
{
1646+
let result: _.LoDashExplicitArrayWrapper<TResult[]>;
1647+
1648+
result = _(array).chain().zip<TResult>(list);
1649+
result = _(array).chain().zip<TResult>(list, array);
1650+
1651+
result = _(list).chain().zip<TResult>(array);
1652+
result = _(list).chain().zip<TResult>(array, list);
1653+
}
1654+
}
16201655

16211656
// _.zipObject
16221657
module TestZipObject {

lodash/lodash.d.ts

Lines changed: 30 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2931,25 +2931,41 @@ declare module _ {
29312931
//_.zip
29322932
interface LoDashStatic {
29332933
/**
2934-
* Creates an array of grouped elements, the first of which contains the first
2935-
* elements of the given arrays, the second of which contains the second elements
2936-
* of the given arrays, and so on.
2937-
* @param arrays Arrays to process.
2938-
* @return A new array of grouped elements.
2939-
**/
2940-
zip(...arrays: any[][]): any[][];
2934+
* Creates an array of grouped elements, the first of which contains the first elements of the given arrays,
2935+
* the second of which contains the second elements of the given arrays, and so on.
2936+
*
2937+
* @param arrays The arrays to process.
2938+
* @return Returns the new array of grouped elements.
2939+
*/
2940+
zip<T>(...arrays: List<T>[]): T[][];
2941+
}
29412942

2943+
interface LoDashImplicitArrayWrapper<T> {
29422944
/**
2943-
* @see _.zip
2944-
**/
2945-
zip(...arrays: any[]): any[];
2945+
* @see _.zip
2946+
*/
2947+
zip<T>(...arrays: List<T>[]): _.LoDashImplicitArrayWrapper<T[]>;
29462948
}
29472949

2948-
interface LoDashImplicitArrayWrapper<T> {
2950+
interface LoDashImplicitObjectWrapper<T> {
29492951
/**
2950-
* @see _.zip
2951-
**/
2952-
zip(...arrays: any[][]): _.LoDashImplicitArrayWrapper<any[][]>;
2952+
* @see _.zip
2953+
*/
2954+
zip<T>(...arrays: List<T>[]): _.LoDashImplicitArrayWrapper<T[]>;
2955+
}
2956+
2957+
interface LoDashExplicitArrayWrapper<T> {
2958+
/**
2959+
* @see _.zip
2960+
*/
2961+
zip<T>(...arrays: List<T>[]): _.LoDashExplicitArrayWrapper<T[]>;
2962+
}
2963+
2964+
interface LoDashExplicitObjectWrapper<T> {
2965+
/**
2966+
* @see _.zip
2967+
*/
2968+
zip<T>(...arrays: List<T>[]): _.LoDashExplicitArrayWrapper<T[]>;
29532969
}
29542970

29552971
//_.zipObject

0 commit comments

Comments
 (0)