Skip to content

Commit

Permalink
feat(filter): support type guards without casting
Browse files Browse the repository at this point in the history
  • Loading branch information
rob3c committed Nov 7, 2016
1 parent bf3c043 commit 68b7922
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/operator/filter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,10 @@ import { TeardownLogic } from '../Subscription';
* @owner Observable
*/
/* tslint:disable:max-line-length */
export function filter<T>(this: Observable<T>, predicate: (value: T, index: number) => boolean, thisArg?: any): Observable<T>;
export function filter<T, S extends T>(this: Observable<T>, predicate: (value: T, index: number) => value is S, thisArg?: any): Observable<S>;
/* tslint:disable:max-line-length */
export function filter<T, S extends T>(this: Observable<T>,
predicate: ((value: T, index: number) => boolean) |
((value: T, index: number) => value is S),
thisArg?: any): Observable<S>;
export function filter<T>(this: Observable<T>, predicate: (value: T, index: number) => boolean,
thisArg?: any): Observable<T> {
return this.lift(new FilterOperator(predicate, thisArg));
Expand Down

0 comments on commit 68b7922

Please sign in to comment.