Skip to content

Commit 287a6fc

Browse files
committed
Merge pull request DefinitelyTyped#6845 from chrootsu/lodash-pullAt
lodash: signatures of _.pullAt have been changed
2 parents e83e33f + 39d60f7 commit 287a6fc

File tree

2 files changed

+61
-22
lines changed

2 files changed

+61
-22
lines changed

lodash/lodash-tests.ts

Lines changed: 45 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -997,26 +997,51 @@ module TestPull {
997997
}
998998

999999
// _.pullAt
1000-
{
1001-
let testPullAtArray: TResult[];
1002-
let testPullAtList: _.List<TResult>;
1003-
let result: TResult[];
1004-
result = _.pullAt<TResult>(testPullAtArray);
1005-
result = _.pullAt<TResult>(testPullAtArray, 1);
1006-
result = _.pullAt<TResult>(testPullAtArray, [2, 3], 1);
1007-
result = _.pullAt<TResult>(testPullAtArray, 4, [2, 3], 1);
1008-
result = _.pullAt<TResult>(testPullAtList);
1009-
result = _.pullAt<TResult>(testPullAtList, 1);
1010-
result = _.pullAt<TResult>(testPullAtList, [2, 3], 1);
1011-
result = _.pullAt<TResult>(testPullAtList, 4, [2, 3], 1);
1012-
result = _(testPullAtArray).pullAt().value();
1013-
result = _(testPullAtArray).pullAt(1).value();
1014-
result = _(testPullAtArray).pullAt([2, 3], 1).value();
1015-
result = _(testPullAtArray).pullAt(4, [2, 3], 1).value();
1016-
result = _(testPullAtList).pullAt<TResult>().value();
1017-
result = _(testPullAtList).pullAt<TResult>(1).value();
1018-
result = _(testPullAtList).pullAt<TResult>([2, 3], 1).value();
1019-
result = _(testPullAtList).pullAt<TResult>(4, [2, 3], 1).value();
1000+
module TestPullAt {
1001+
let array: TResult[];
1002+
let list: _.List<TResult>;
1003+
1004+
{
1005+
let result: TResult[];
1006+
1007+
result = _.pullAt<TResult>(array);
1008+
result = _.pullAt<TResult>(array, 1);
1009+
result = _.pullAt<TResult>(array, [2, 3], 1);
1010+
result = _.pullAt<TResult>(array, 4, [2, 3], 1);
1011+
1012+
result = _.pullAt<TResult>(list);
1013+
result = _.pullAt<TResult>(list, 1);
1014+
result = _.pullAt<TResult>(list, [2, 3], 1);
1015+
result = _.pullAt<TResult>(list, 4, [2, 3], 1);
1016+
}
1017+
1018+
{
1019+
let result: _.LoDashImplicitArrayWrapper<TResult>;
1020+
1021+
result = _(array).pullAt();
1022+
result = _(array).pullAt(1);
1023+
result = _(array).pullAt([2, 3], 1);
1024+
result = _(array).pullAt(4, [2, 3], 1);
1025+
1026+
result = _(list).pullAt<TResult>();
1027+
result = _(list).pullAt<TResult>(1);
1028+
result = _(list).pullAt<TResult>([2, 3], 1);
1029+
result = _(list).pullAt<TResult>(4, [2, 3], 1);
1030+
}
1031+
1032+
{
1033+
let result: _.LoDashExplicitArrayWrapper<TResult>;
1034+
1035+
result = _(array).chain().pullAt();
1036+
result = _(array).chain().pullAt(1);
1037+
result = _(array).chain().pullAt([2, 3], 1);
1038+
result = _(array).chain().pullAt(4, [2, 3], 1);
1039+
1040+
result = _(list).chain().pullAt<TResult>();
1041+
result = _(list).chain().pullAt<TResult>(1);
1042+
result = _(list).chain().pullAt<TResult>([2, 3], 1);
1043+
result = _(list).chain().pullAt<TResult>(4, [2, 3], 1);
1044+
}
10201045
}
10211046

10221047
// _.remove

lodash/lodash.d.ts

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1582,7 +1582,7 @@ declare module _ {
15821582
* @return Returns the new array of removed elements.
15831583
*/
15841584
pullAt<T>(
1585-
array: T[]|List<T>,
1585+
array: List<T>,
15861586
...indexes: (number|number[])[]
15871587
): T[];
15881588
}
@@ -1598,7 +1598,21 @@ declare module _ {
15981598
/**
15991599
* @see _.pullAt
16001600
*/
1601-
pullAt<TValue>(...indexes: (number|number[])[]): LoDashImplicitArrayWrapper<TValue>;
1601+
pullAt<T>(...indexes: (number|number[])[]): LoDashImplicitArrayWrapper<T>;
1602+
}
1603+
1604+
interface LoDashExplicitArrayWrapper<T> {
1605+
/**
1606+
* @see _.pullAt
1607+
*/
1608+
pullAt(...indexes: (number|number[])[]): LoDashExplicitArrayWrapper<T>;
1609+
}
1610+
1611+
interface LoDashExplicitObjectWrapper<T> {
1612+
/**
1613+
* @see _.pullAt
1614+
*/
1615+
pullAt<T>(...indexes: (number|number[])[]): LoDashExplicitArrayWrapper<T>;
16021616
}
16031617

16041618
//_.remove

0 commit comments

Comments
 (0)