diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index b1e2853d8..2cd889d54 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -357,8 +357,17 @@ module TestIndexOf { result = _(testIntersectionList).intersection(testIntersectionList, testIntersectionArray).value(); } -result = _.last([1, 2, 3]); -result = _([1, 2, 3]).last(); +// _.last +module TestLast { + let array: TResult[]; + let list: _.List; + let result: TResult; + + result = _.last(array); + result = _.last(list); + result = _(array).last(); + result = _(list).last(); +} result = _.lastIndexOf([1, 2, 3, 1, 2, 3], 2); result = _.lastIndexOf([1, 2, 3, 1, 2, 3], 2, 3); diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index f23053d9b..9c7a4f694 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -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(array: Array): T; + * Gets the last element of array. + * + * @param array The array to query. + * @return Returns the last element of array. + */ + last(array: List): T; } interface LoDashArrayWrapper { /** * @see _.last - **/ + */ last(): T; } + interface LoDashObjectWrapper { + /** + * @see _.last + */ + last(): T; + } + //_.lastIndexOf interface LoDashStatic { /**