diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index ca0404c11..3e3e7e101 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -758,9 +758,34 @@ module TestTakeWhile { result = _(list).takeWhile<{a: number;}, TResult>({a: 42}).value(); } -result = _.union([1, 2, 3], [101, 2, 1, 10], [2, 1]); +// _.union +module TestUnion { + let array: TResult[]; + let list: _.List; + let result: TResult[]; -result = _([1, 2, 3]).union([101, 2, 1, 10], [2, 1]).value(); + result = _.union(); + + result = _.union(array); + result = _.union(array, list); + result = _.union(array, list, array); + + result = _.union(list); + result = _.union(list, array); + result = _.union(list, array, list); + + result = _(array).union().value(); + result = _(array).union(list).value(); + result = _(array).union(list, array).value(); + + result = _(array).union().value(); + result = _(array).union(list).value(); + result = _(array).union(list, array).value(); + + result = _(list).union().value(); + result = _(list).union(array).value(); + result = _(list).union(array, list).value(); +} result = _.uniq([1, 2, 1, 3, 1]); result = _.uniq([1, 1, 2, 2, 3], true); diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index 685e43a96..423c232fa 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -1651,24 +1651,32 @@ declare module _ { //_.union interface LoDashStatic { /** - * Creates an array of unique values, in order, of the provided arrays using strict - * equality for comparisons, i.e. ===. - * @param arrays The arrays to inspect. - * @return Returns an array of composite values. - **/ - union(...arrays: Array[]): T[]; - - /** - * @see _.union - **/ + * Creates an array of unique values, in order, from all of the provided arrays using SameValueZero for + * equality comparisons. + * + * @param arrays The arrays to inspect. + * @return Returns the new array of combined values. + */ union(...arrays: List[]): T[]; } interface LoDashArrayWrapper { /** - * @see _.union - **/ - union(...arrays: (Array|List)[]): LoDashArrayWrapper; + * @see _.union + */ + union(...arrays: List[]): LoDashArrayWrapper; + + /** + * @see _.union + */ + union(...arrays: List[]): LoDashArrayWrapper; + } + + interface LoDashObjectWrapper { + /** + * @see _.union + */ + union(...arrays: List[]): LoDashArrayWrapper; } //_.uniq