Skip to content

Commit

Permalink
feat: allow type guards for filter (#39) (#40)
Browse files Browse the repository at this point in the history
  • Loading branch information
iimog authored May 12, 2021
1 parent 72eaf3b commit 149fc1d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/tidy/src/filter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ import { TidyFn } from './types';
* Filters items
* @param filterFn Returns true to keep the item, false to filter out
*/
export function filter<T extends object, O extends T>(
filterFn: (item: T, index: number, array: T[]) => item is O
): TidyFn<T, O>;
export function filter<T extends object>(
filterFn: (item: T, index: number, array: T[]) => boolean
): TidyFn<T>;
export function filter<T extends object>(
filterFn: (item: T, index: number, array: T[]) => boolean
): TidyFn<T> {
Expand Down

0 comments on commit 149fc1d

Please sign in to comment.