diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 1d5525300..0e4b1cc0d 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -345,8 +345,17 @@ result = _.indexOf([1, 1, 2, 2, 3, 3], 2, true); 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 102811a16..f0c6f186c 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -872,20 +872,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 { /**