diff --git a/async/filter.ts b/async/filter.ts index 51ae8db..2937c4c 100644 --- a/async/filter.ts +++ b/async/filter.ts @@ -1,3 +1,11 @@ +export function filter( + iterable: Iterable | AsyncIterable, + fn: (value: T, index: number) => boolean | Promise, +): AsyncIterable; +export function filter( + iterable: Iterable | AsyncIterable, + fn: (value: T, index: number) => value is U, +): AsyncIterable; /** * Filters an iterable based on a function. * diff --git a/filter.ts b/filter.ts index 05a4b8b..a6326a4 100644 --- a/filter.ts +++ b/filter.ts @@ -1,3 +1,11 @@ +export function filter( + iterable: Iterable, + fn: (value: T, index: number) => boolean, +): Iterable; +export function filter( + iterable: Iterable, + fn: (value: T, index: number) => value is U, +): Iterable; /** * Filters an iterable based on a function. * diff --git a/pipe/async/filter.ts b/pipe/async/filter.ts index be160af..0660d8d 100644 --- a/pipe/async/filter.ts +++ b/pipe/async/filter.ts @@ -1,5 +1,11 @@ import { filter as base } from "../../async/filter.ts"; +export function filter( + fn: (value: T, index: number) => boolean | Promise, +): (iterable: Iterable | AsyncIterable) => AsyncIterable; +export function filter( + fn: (value: T, index: number) => value is U, +): (iterable: Iterable | AsyncIterable) => AsyncIterable; /** * Returns an operator that filters an iterable based on a function. * diff --git a/pipe/filter.ts b/pipe/filter.ts index 065ded8..260471a 100644 --- a/pipe/filter.ts +++ b/pipe/filter.ts @@ -1,5 +1,11 @@ import { filter as base } from "../filter.ts"; +export function filter( + fn: (value: T, index: number) => boolean, +): (iterable: Iterable) => Iterable; +export function filter( + fn: (value: T, index: number) => value is U, +): (iterable: Iterable) => Iterable; /** * Returns an operator that filters an iterable based on a function. *