Skip to content

Commit f3c33cd

Browse files
feat(filter): Observable<T>.filter() can take type guard as the predicate function
1 parent d876a35 commit f3c33cd

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/operator/filter.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ export function filter<T>(predicate: (value: T, index: number) => boolean,
5050

5151
export interface FilterSignature<T> {
5252
(predicate: (value: T, index: number) => boolean, thisArg?: any): Observable<T>;
53+
<S extends T>(predicate: (value: T, index: number) => value is S, thisArg?: any): Observable<S>;
5354
}
5455

5556
class FilterOperator<T> implements Operator<T, T> {

0 commit comments

Comments
 (0)