Skip to content

Commit 87d9fa6

Browse files
committed
Merge pull request DefinitelyTyped#6914 from chrootsu/lodash-at
lodash: signatures of _.at have been changed
2 parents aa6ae66 + 5493d57 commit 87d9fa6

File tree

2 files changed

+45
-14
lines changed

2 files changed

+45
-14
lines changed

lodash/lodash-tests.ts

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2557,17 +2557,34 @@ module TestAny {
25572557
}
25582558

25592559
// _.at
2560-
{
2561-
let testAtArray: TResult[];
2562-
let testAtList: _.List<TResult>;
2563-
let testAtDictionary: _.Dictionary<TResult>;
2564-
let result: TResult[];
2565-
result = _.at<TResult>(testAtArray, 0, '1', [2], ['3'], [4, '5']);
2566-
result = _.at<TResult>(testAtList, 0, '1', [2], ['3'], [4, '5']);
2567-
result = _.at<TResult>(testAtDictionary, 0, '1', [2], ['3'], [4, '5']);
2568-
result = _(testAtArray).at(0, '1', [2], ['3'], [4, '5']).value();
2569-
result = _(testAtList).at<TResult>(0, '1', [2], ['3'], [4, '5']).value();
2570-
result = _(testAtDictionary).at<TResult>(0, '1', [2], ['3'], [4, '5']).value();
2560+
module TestAt {
2561+
let array: TResult[];
2562+
let list: _.List<TResult>;
2563+
let dictionary: _.Dictionary<TResult>;
2564+
2565+
{
2566+
let result: TResult[];
2567+
2568+
result = _.at<TResult>(array, 0, '1', [2], ['3'], [4, '5']);
2569+
result = _.at<TResult>(list, 0, '1', [2], ['3'], [4, '5']);
2570+
result = _.at<TResult>(dictionary, 0, '1', [2], ['3'], [4, '5']);
2571+
}
2572+
2573+
{
2574+
let result: _.LoDashImplicitArrayWrapper<TResult>;
2575+
2576+
result = _(array).at(0, '1', [2], ['3'], [4, '5']);
2577+
result = _(list).at<TResult>(0, '1', [2], ['3'], [4, '5']);
2578+
result = _(dictionary).at<TResult>(0, '1', [2], ['3'], [4, '5']);
2579+
}
2580+
2581+
{
2582+
let result: _.LoDashExplicitArrayWrapper<TResult>;
2583+
2584+
result = _(array).chain().at(0, '1', [2], ['3'], [4, '5']);
2585+
result = _(list).chain().at<TResult>(0, '1', [2], ['3'], [4, '5']);
2586+
result = _(dictionary).chain().at<TResult>(0, '1', [2], ['3'], [4, '5']);
2587+
}
25712588
}
25722589

25732590
// _.collect

lodash/lodash.d.ts

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3793,22 +3793,36 @@ declare module _ {
37933793
*/
37943794
at<T>(
37953795
collection: List<T>|Dictionary<T>,
3796-
...props: Array<number|string|Array<number|string>>
3796+
...props: (number|string|(number|string)[])[]
37973797
): T[];
37983798
}
37993799

38003800
interface LoDashImplicitArrayWrapper<T> {
38013801
/**
38023802
* @see _.at
38033803
*/
3804-
at(...props: Array<number|string|Array<number|string>>): LoDashImplicitArrayWrapper<T>;
3804+
at(...props: (number|string|(number|string)[])[]): LoDashImplicitArrayWrapper<T>;
38053805
}
38063806

38073807
interface LoDashImplicitObjectWrapper<T> {
38083808
/**
38093809
* @see _.at
38103810
*/
3811-
at<TResult>(...props: Array<number|string|Array<number|string>>): LoDashImplicitArrayWrapper<TResult>;
3811+
at<T>(...props: (number|string|(number|string)[])[]): LoDashImplicitArrayWrapper<T>;
3812+
}
3813+
3814+
interface LoDashExplicitArrayWrapper<T> {
3815+
/**
3816+
* @see _.at
3817+
*/
3818+
at(...props: (number|string|(number|string)[])[]): LoDashExplicitArrayWrapper<T>;
3819+
}
3820+
3821+
interface LoDashExplicitObjectWrapper<T> {
3822+
/**
3823+
* @see _.at
3824+
*/
3825+
at<T>(...props: (number|string|(number|string)[])[]): LoDashExplicitArrayWrapper<T>;
38123826
}
38133827

38143828
//_.collect

0 commit comments

Comments
 (0)