diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index de1331372..f23220229 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -610,16 +610,36 @@ module TestIndexOf { } // _.intersection -{ - let testIntersectionArray: TResult[]; - let testIntersectionList: _.List; - let result: TResult[]; - result = _.intersection(testIntersectionArray, testIntersectionList); - result = _.intersection(testIntersectionList, testIntersectionArray, testIntersectionList); - result = _(testIntersectionArray).intersection(testIntersectionArray).value(); - result = _(testIntersectionArray).intersection(testIntersectionList, testIntersectionArray).value(); - result = _(testIntersectionList).intersection(testIntersectionArray).value(); - result = _(testIntersectionList).intersection(testIntersectionList, testIntersectionArray).value(); +module TestIntersection { + let array: TResult[]; + let list: _.List; + + { + let result: TResult[]; + + result = _.intersection(array, list); + result = _.intersection(list, array, list); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(array).intersection(array); + result = _(array).intersection(list, array); + + result = _(list).intersection(array); + result = _(list).intersection(list, array); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(array).chain().intersection(array); + result = _(array).chain().intersection(list, array); + + result = _(list).chain().intersection(array); + result = _(list).chain().intersection(list, array); + } } // _.last diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 6050e4ff3..3dba7abe9 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -1145,6 +1145,20 @@ declare module _ { intersection(...arrays: (TResult[]|List)[]): LoDashImplicitArrayWrapper; } + interface LoDashExplicitArrayWrapper { + /** + * @see _.intersection + */ + intersection(...arrays: (TResult[]|List)[]): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.intersection + */ + intersection(...arrays: (TResult[]|List)[]): LoDashExplicitArrayWrapper; + } + //_.last interface LoDashStatic { /**