mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
Merge pull request #6054 from chrootsu/lodash-last
lodash: changed _.last() method
This commit is contained in:
+11
-2
@@ -357,8 +357,17 @@ module TestIndexOf {
|
||||
result = _(testIntersectionList).intersection<TResult>(testIntersectionList, testIntersectionArray).value();
|
||||
}
|
||||
|
||||
result = <number>_.last([1, 2, 3]);
|
||||
result = <number>_([1, 2, 3]).last();
|
||||
// _.last
|
||||
module TestLast {
|
||||
let array: TResult[];
|
||||
let list: _.List<TResult>;
|
||||
let result: TResult;
|
||||
|
||||
result = _.last<TResult>(array);
|
||||
result = _.last<TResult>(list);
|
||||
result = _<TResult>(array).last();
|
||||
result = _(list).last<TResult>();
|
||||
}
|
||||
|
||||
result = <number>_.lastIndexOf([1, 2, 3, 1, 2, 3], 2);
|
||||
result = <number>_.lastIndexOf([1, 2, 3, 1, 2, 3], 2, 3);
|
||||
|
||||
Vendored
+14
-6
@@ -817,20 +817,28 @@ declare module _ {
|
||||
//_.last
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
* Gets the last element of an array.
|
||||
* @param array The array to query.
|
||||
* @return Returns the last element of array.
|
||||
**/
|
||||
last<T>(array: Array<T>): T;
|
||||
* Gets the last element of array.
|
||||
*
|
||||
* @param array The array to query.
|
||||
* @return Returns the last element of array.
|
||||
*/
|
||||
last<T>(array: List<T>): T;
|
||||
}
|
||||
|
||||
interface LoDashArrayWrapper<T> {
|
||||
/**
|
||||
* @see _.last
|
||||
**/
|
||||
*/
|
||||
last(): T;
|
||||
}
|
||||
|
||||
interface LoDashObjectWrapper<T> {
|
||||
/**
|
||||
* @see _.last
|
||||
*/
|
||||
last<T>(): T;
|
||||
}
|
||||
|
||||
//_.lastIndexOf
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user