Skip to content

Commit

Permalink
fix(filter): Sort overloads to correct order
Browse files Browse the repository at this point in the history
  • Loading branch information
4513ECHO committed Aug 20, 2024
1 parent ed13790 commit 78d4eaf
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
8 changes: 4 additions & 4 deletions async/filter.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
export function filter<T>(
iterable: Iterable<T> | AsyncIterable<T>,
fn: (value: T, index: number) => boolean | Promise<boolean>,
): AsyncIterable<T>;
export function filter<T, U extends T>(
iterable: Iterable<T> | AsyncIterable<T>,
fn: (value: T, index: number) => value is U,
): AsyncIterable<U>;
export function filter<T>(
iterable: Iterable<T> | AsyncIterable<T>,
fn: (value: T, index: number) => boolean | Promise<boolean>,
): AsyncIterable<T>;
/**
* Filters an iterable based on a function.
*
Expand Down
8 changes: 4 additions & 4 deletions filter.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
export function filter<T>(
iterable: Iterable<T>,
fn: (value: T, index: number) => boolean,
): Iterable<T>;
export function filter<T, U extends T>(
iterable: Iterable<T>,
fn: (value: T, index: number) => value is U,
): Iterable<U>;
export function filter<T>(
iterable: Iterable<T>,
fn: (value: T, index: number) => boolean,
): Iterable<T>;
/**
* Filters an iterable based on a function.
*
Expand Down
6 changes: 3 additions & 3 deletions pipe/async/filter.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { filter as base } from "../../async/filter.ts";

export function filter<T>(
fn: (value: T, index: number) => boolean | Promise<boolean>,
): (iterable: Iterable<T> | AsyncIterable<T>) => AsyncIterable<T>;
export function filter<T, U extends T>(
fn: (value: T, index: number) => value is U,
): (iterable: Iterable<T> | AsyncIterable<T>) => AsyncIterable<U>;
export function filter<T>(
fn: (value: T, index: number) => boolean | Promise<boolean>,
): (iterable: Iterable<T> | AsyncIterable<T>) => AsyncIterable<T>;
/**
* Returns an operator that filters an iterable based on a function.
*
Expand Down
6 changes: 3 additions & 3 deletions pipe/filter.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { filter as base } from "../filter.ts";

export function filter<T>(
fn: (value: T, index: number) => boolean,
): (iterable: Iterable<T>) => Iterable<T>;
export function filter<T, U extends T>(
fn: (value: T, index: number) => value is U,
): (iterable: Iterable<T>) => Iterable<U>;
export function filter<T>(
fn: (value: T, index: number) => boolean,
): (iterable: Iterable<T>) => Iterable<T>;
/**
* Returns an operator that filters an iterable based on a function.
*
Expand Down

0 comments on commit 78d4eaf

Please sign in to comment.