diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 2df3c9297c..8253af730c 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -914,15 +914,32 @@ module TestRest { } // _.slice -{ - let testSliceArray: TResult[]; - let result: TResult[]; - result = _.slice(testSliceArray); - result = _.slice(testSliceArray, 42); - result = _.slice(testSliceArray, 42, 42); - result = _(testSliceArray).slice().value(); - result = _(testSliceArray).slice(42).value(); - result = _(testSliceArray).slice(42, 42).value(); +module TestSlice { + let array: TResult[]; + + { + let result: TResult[]; + + result = _.slice(array); + result = _.slice(array, 42); + result = _.slice(array, 42, 42); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(array).slice(); + result = _(array).slice(42); + result = _(array).slice(42, 42); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(array).chain().slice(); + result = _(array).chain().slice(42); + result = _(array).chain().slice(42, 42); + } } result = _.sortedIndex([20, 30, 50], 40); diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index c2547fd01a..db27b7e438 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -1599,6 +1599,16 @@ declare module _ { ): LoDashImplicitArrayWrapper; } + interface LoDashExplicitArrayWrapper { + /** + * @see _.slice + */ + slice( + start?: number, + end?: number + ): LoDashExplicitArrayWrapper; + } + //_.sortedIndex interface LoDashStatic { /**