Skip to content

Commit 60e333c

Browse files
committed
Merge pull request DefinitelyTyped#5888 from chrootsu/lodash-without
lodash: changed _.without() method
2 parents d4e31c7 + 85aa870 commit 60e333c

File tree

2 files changed

+43
-13
lines changed

2 files changed

+43
-13
lines changed

lodash/lodash-tests.ts

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,28 @@ result = <{ x: number; }[]>_([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }]).unique('x').v
497497
result = _(testUnzipWithList).unzipWith<number, TResult>(testUnzipWithIterator, any).value();
498498
}
499499

500-
result = <number[]>_.without([1, 2, 1, 0, 3, 1, 4], 0, 1);
500+
// _.without
501+
{
502+
let testWithoutArray: number[];
503+
let testWithoutList: _.List<number>;
504+
let result: number[];
505+
result = _.without<number>(testWithoutArray);
506+
result = _.without<number>(testWithoutArray, 1);
507+
result = _.without<number>(testWithoutArray, 1, 2);
508+
result = _.without<number>(testWithoutArray, 1, 2, 3);
509+
result = _.without<number>(testWithoutList);
510+
result = _.without<number>(testWithoutList, 1);
511+
result = _.without<number>(testWithoutList, 1, 2);
512+
result = _.without<number>(testWithoutList, 1, 2, 3);
513+
result = _(testWithoutArray).without().value();
514+
result = _(testWithoutArray).without(1).value();
515+
result = _(testWithoutArray).without(1, 2).value();
516+
result = _(testWithoutArray).without(1, 2, 3).value();
517+
result = _(testWithoutList).without<number>().value();
518+
result = _(testWithoutList).without<number>(1).value();
519+
result = _(testWithoutList).without<number>(1, 2).value();
520+
result = _(testWithoutList).without<number>(1, 2, 3).value();
521+
}
501522

502523
// _.xor
503524
var testXorArray: number[];

lodash/lodash.d.ts

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1878,21 +1878,30 @@ declare module _ {
18781878
//_.without
18791879
interface LoDashStatic {
18801880
/**
1881-
* Creates an array excluding all provided values using strict equality for comparisons, i.e. ===.
1882-
* @param array The array to filter.
1883-
* @param values The value(s) to exclude.
1884-
* @return A new array of filtered values.
1885-
**/
1881+
* Creates an array excluding all provided values using SameValueZero for equality comparisons.
1882+
*
1883+
* @param array The array to filter.
1884+
* @param values The values to exclude.
1885+
* @return Returns the new array of filtered values.
1886+
*/
18861887
without<T>(
1887-
array: Array<T>,
1888-
...values: T[]): T[];
1888+
array: T[]|List<T>,
1889+
...values: T[]
1890+
): T[];
1891+
}
18891892

1893+
interface LoDashArrayWrapper<T> {
18901894
/**
1891-
* @see _.without
1892-
**/
1893-
without<T>(
1894-
array: List<T>,
1895-
...values: T[]): T[];
1895+
* @see _.without
1896+
*/
1897+
without(...values: T[]): LoDashArrayWrapper<T>;
1898+
}
1899+
1900+
interface LoDashObjectWrapper<T> {
1901+
/**
1902+
* @see _.without
1903+
*/
1904+
without<TValue>(...values: TValue[]): LoDashArrayWrapper<TValue>;
18961905
}
18971906

18981907
//_.xor

0 commit comments

Comments
 (0)