From 68b792293c660d3de584f6970efa6b7ea44634e9 Mon Sep 17 00:00:00 2001 From: Robert Raiford Date: Mon, 7 Nov 2016 16:14:38 -0500 Subject: [PATCH] feat(filter): support type guards without casting --- src/operator/filter.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/operator/filter.ts b/src/operator/filter.ts index 3c13f92e05..50700ccf98 100644 --- a/src/operator/filter.ts +++ b/src/operator/filter.ts @@ -44,9 +44,10 @@ import { TeardownLogic } from '../Subscription'; * @owner Observable */ /* tslint:disable:max-line-length */ -export function filter(this: Observable, predicate: (value: T, index: number) => boolean, thisArg?: any): Observable; -export function filter(this: Observable, predicate: (value: T, index: number) => value is S, thisArg?: any): Observable; -/* tslint:disable:max-line-length */ +export function filter(this: Observable, + predicate: ((value: T, index: number) => boolean) | + ((value: T, index: number) => value is S), + thisArg?: any): Observable; export function filter(this: Observable, predicate: (value: T, index: number) => boolean, thisArg?: any): Observable { return this.lift(new FilterOperator(predicate, thisArg));