mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 14:57:10 +00:00
Update lodash/fp/filter to support string[].
This commit is contained in:
Vendored
+3
-3
@@ -215,7 +215,7 @@ declare module "../index" {
|
||||
* @return Returns the new filtered array.
|
||||
*/
|
||||
filter(
|
||||
collection: string | null | undefined,
|
||||
collection: string | string[] | null | undefined,
|
||||
predicate?: StringIterator<boolean>
|
||||
): string[];
|
||||
|
||||
@@ -257,7 +257,7 @@ declare module "../index" {
|
||||
* @see _.filter
|
||||
*/
|
||||
filter(
|
||||
this: LoDashImplicitWrapper<string | null | undefined>,
|
||||
this: LoDashImplicitWrapper<string | string[] | null | undefined>,
|
||||
predicate?: StringIterator<boolean>
|
||||
): LoDashImplicitWrapper<string[]>;
|
||||
|
||||
@@ -299,7 +299,7 @@ declare module "../index" {
|
||||
* @see _.filter
|
||||
*/
|
||||
filter(
|
||||
this: LoDashExplicitWrapper<string | null | undefined>,
|
||||
this: LoDashExplicitWrapper<string | string[] | null | undefined>,
|
||||
predicate?: StringIterator<boolean>
|
||||
): LoDashExplicitWrapper<string[]>;
|
||||
|
||||
|
||||
Vendored
+3
-3
@@ -918,8 +918,8 @@ declare namespace _ {
|
||||
type LodashFill2x14<T, U> = (start: number) => lodash.List<T | U>;
|
||||
interface LodashFilter {
|
||||
(predicate: (value: string) => boolean): LodashFilter1x1;
|
||||
(predicate: lodash.__, collection: string | null | undefined): LodashFilter1x2;
|
||||
(predicate: (value: string) => boolean, collection: string | null | undefined): string[];
|
||||
(predicate: lodash.__, collection: string | string[] | null | undefined): LodashFilter1x2;
|
||||
(predicate: (value: string) => boolean, collection: string | string[] | null | undefined): string[];
|
||||
<T, S extends T>(predicate: lodash.ValueIteratorTypeGuard<T, S>): LodashFilter2x1<T, S>;
|
||||
<T>(predicate: lodash.__, collection: lodash.List<T> | null | undefined): LodashFilter2x2<T>;
|
||||
<T, S extends T>(predicate: lodash.ValueIteratorTypeGuard<T, S>, collection: lodash.List<T> | null | undefined): S[];
|
||||
@@ -930,7 +930,7 @@ declare namespace _ {
|
||||
<T extends object, S extends T[keyof T]>(predicate: lodash.ValueIteratorTypeGuard<T[keyof T], S>, collection: T | null | undefined): S[];
|
||||
<T extends object>(predicate: lodash.ValueIterateeCustom<T[keyof T], boolean>, collection: T | null | undefined): Array<T[keyof T]>;
|
||||
}
|
||||
type LodashFilter1x1 = (collection: string | null | undefined) => string[];
|
||||
type LodashFilter1x1 = (collection: string | string[] | null | undefined) => string[];
|
||||
type LodashFilter1x2 = (predicate: (value: string) => boolean) => string[];
|
||||
type LodashFilter2x1<T, S> = (collection: lodash.List<T> | null | undefined) => S[];
|
||||
interface LodashFilter2x2<T> {
|
||||
|
||||
@@ -1766,6 +1766,7 @@ _.chain([1, 2, 3, 4]).unshift(5, 6); // $ExpectType LoDashExplicitWrapper<number
|
||||
fp.filter("", dictionary); // $ExpectType AbcObject[]
|
||||
fp.filter({ a: 42 }, dictionary); // $ExpectType AbcObject[]
|
||||
fp.filter(["a", 42], dictionary); // $ExpectType AbcObject[]
|
||||
fp.filter(Boolean)(["a", "b"]); // $ExpectType string[]
|
||||
|
||||
// Test filtering with type guard
|
||||
const a2: Array<string | number> | null | undefined = anything;
|
||||
|
||||
Vendored
+2
-2
@@ -459,7 +459,7 @@ declare module "./index" {
|
||||
predicate?: _.ObjectIterateeCustom<T, boolean>
|
||||
): LoDashExplicitSyncWrapper<boolean>;
|
||||
filter(
|
||||
this: LoDashExplicitSyncWrapper<string | null | undefined>,
|
||||
this: LoDashExplicitSyncWrapper<string | string[] | null | undefined>,
|
||||
predicate?: _.StringIterator<boolean>
|
||||
): LoDashExplicitSyncWrapper<string[]>;
|
||||
filter<T, S extends T>(
|
||||
@@ -2055,7 +2055,7 @@ declare module "./index" {
|
||||
predicate?: _.ObjectIterateeCustom<T, boolean>
|
||||
): LoDashExplicitAsyncWrapper<boolean>;
|
||||
filter(
|
||||
this: LoDashExplicitAsyncWrapper<string | null | undefined>,
|
||||
this: LoDashExplicitAsyncWrapper<string | string[] | null | undefined>,
|
||||
predicate?: _.StringIterator<boolean>
|
||||
): LoDashExplicitAsyncWrapper<string[]>;
|
||||
filter<T, S extends T>(
|
||||
|
||||
Reference in New Issue
Block a user