diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 633c4ed0d..e0f2b8226 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -605,6 +605,8 @@ result = _(foodsCombined).reject({ 'type': 'fruit' }).value(); result = _.sample([1, 2, 3, 4]); result = _.sample([1, 2, 3, 4], 2); +result = <_.LoDashArrayWrapper>_([1, 2, 3, 4]).sample(); +result = <_.LoDashArrayWrapper>_([1, 2, 3, 4]).sample(2); result = _.shuffle([1, 2, 3, 4, 5, 6]); result = <_.LoDashArrayWrapper>_([1, 2, 3]).shuffle(); diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 9cb55485d..a906b907f 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -22,7 +22,7 @@ declare module _ { * forEach, forEachRight, forIn, forInRight, forOwn, forOwnRight, functions, groupBy, * indexBy, initial, intersection, invert, invoke, keys, map, max, memoize, merge, min, * object, omit, once, pairs, partial, partialRight, pick, pluck, pull, push, range, reject, - * remove, rest, reverse, shuffle, slice, sort, sortBy, splice, tap, throttle, times, + * remove, rest, reverse, sample, shuffle, slice, sort, sortBy, splice, tap, throttle, times, * toArray, transform, union, uniq, unshift, unzip, values, where, without, wrap, and zip * * The non-chainable wrapper functions are: @@ -4559,6 +4559,18 @@ declare module _ { sample(collection: Dictionary, n: number): T[]; } + interface LoDashArrayWrapper { + /** + * @see _.sample + **/ + sample(n: number): LoDashArrayWrapper; + + /** + * @see _.sample + **/ + sample(): LoDashArrayWrapper; + } + //_.shuffle interface LoDashStatic { /**