Skip to content

Commit

Permalink
update reject to match
Browse files Browse the repository at this point in the history
  • Loading branch information
Harris-Miller committed Mar 5, 2024
1 parent 49cf1c7 commit f5901af
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions types/reject.d.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
export function reject<A, P extends A>(
pred: (val: A) => val is P,
): {
<B extends A>(list: readonly B[]): Array<Exclude<B, P>>;
<B extends A>(dict: Record<string, B>): Record<string, Exclude<B, P>>;
<B extends A>(list: readonly B[]): Exclude<B, P>[];
};
export function reject<T>(
pred: (value: T) => boolean,
): <P extends T, C extends readonly P[] | Record<string, P>>(collection: C) => C;
export function reject<A, B extends A, P extends A>(
pred: (val: A) => val is P,
list: readonly B[],
): Array<Exclude<B, P>>;
export function reject<A, B extends A, P extends A>(
pred: (val: A) => val is P,
dict: Record<string, B>,
): Record<string, Exclude<B, P>>;
export function reject<T, P extends T>(pred: (val: T) => val is P, dict: Record<string, T>): Record<string, Exclude<T, P>>;
export function reject<T, P extends T>(pred: (val: T) => val is P, list: readonly T[]): Exclude<T, P>[];
export function reject<T, C extends readonly T[] | Record<string, T>>(pred: (value: T) => boolean, collection: C): C;

0 comments on commit f5901af

Please sign in to comment.