diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index a2184f6a9..4275e559c 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -302,7 +302,18 @@ result = _.indexOf([1, 1, 2, 2, 3, 3], 2, true); result = _(testInitalList).initial().value(); } -result = _.intersection([1, 2, 3], [101, 2, 1, 10], [2, 1]); +// _.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(); +} result = _.last([1, 2, 3]); result = _([1, 2, 3]).last(); diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 50ba6ac96..ec0592b79 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -988,17 +988,27 @@ declare module _ { //_.intersection interface LoDashStatic { /** - * Creates an array of unique values present in all provided arrays using strict - * equality for comparisons, i.e. ===. - * @param arrays The arrays to inspect. - * @return Returns an array of composite values. - **/ - intersection(...arrays: Array[]): T[]; + * Creates an array of unique values that are included in all of the provided arrays using SameValueZero for + * equality comparisons. + * + * @param arrays The arrays to inspect. + * @return Returns the new array of shared values. + */ + intersection(...arrays: (T[]|List)[]): T[]; + } + interface LoDashArrayWrapper { /** - * @see _.intersection - **/ - intersection(...arrays: List[]): T[]; + * @see _.intersection + */ + intersection(...arrays: (TResult[]|List)[]): LoDashArrayWrapper; + } + + interface LoDashObjectWrapper { + /** + * @see _.intersection + */ + intersection(...arrays: (TResult[]|List)[]): LoDashArrayWrapper; } //_.last