diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 90f1ffc33..ba82ceeb7 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -1151,18 +1151,39 @@ module TestTake { } // _.takeRight -{ - let testTakeRightArray: TResult[]; - let testTakeRightList: _.List; - let result: TResult[]; - result = _.takeRight(testTakeRightArray); - result = _.takeRight(testTakeRightArray, 42); - result = _.takeRight(testTakeRightList); - result = _.takeRight(testTakeRightList, 42); - result = _(testTakeRightArray).takeRight().value(); - result = _(testTakeRightArray).takeRight(42).value(); - result = _(testTakeRightList).takeRight().value(); - result = _(testTakeRightList).takeRight(42).value(); +module TestTakeRight { + let array: TResult[]; + let list: _.List; + + { + let result: TResult[]; + + result = _.takeRight(array); + result = _.takeRight(array, 42); + + result = _.takeRight(list); + result = _.takeRight(list, 42); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(array).takeRight(); + result = _(array).takeRight(42); + + result = _(list).takeRight(); + result = _(list).takeRight(42); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(array).chain().takeRight(); + result = _(array).chain().takeRight(42); + + result = _(list).chain().takeRight(); + result = _(list).chain().takeRight(42); + } } // _.takeRightWhile diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 88996d03e..91f7227e8 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -1994,7 +1994,7 @@ declare module _ { * @return Returns the slice of array. */ takeRight( - array: T[]|List, + array: List, n?: number ): T[]; } @@ -2013,6 +2013,20 @@ declare module _ { takeRight(n?: number): LoDashImplicitArrayWrapper; } + interface LoDashExplicitArrayWrapper { + /** + * @see _.takeRight + */ + takeRight(n?: number): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.takeRight + */ + takeRight(n?: number): LoDashExplicitArrayWrapper; + } + //_.takeRightWhile interface LoDashStatic { /**