From 3aa1988d8c60be4851101a26eba53927ff85753a Mon Sep 17 00:00:00 2001 From: Robert Raiford Date: Mon, 7 Nov 2016 16:16:02 -0500 Subject: [PATCH] feat(first): support type guards without casting --- src/operator/first.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/operator/first.ts b/src/operator/first.ts index 80d442820c..9fb8314ef1 100644 --- a/src/operator/first.ts +++ b/src/operator/first.ts @@ -53,10 +53,15 @@ import { EmptyError } from '../util/EmptyError'; * @owner Observable */ /* tslint:disable:max-line-length */ -export function first(this: Observable, predicate?: (value: T, index: number, source: Observable) => boolean): Observable; -export function first(this: Observable, predicate?: (value: T, index: number, source: Observable) => value is S): Observable; +export function first(this: Observable, + predicate?: ((value: T, index: number, source: Observable) => boolean) | + ((value: T, index: number, source: Observable) => value is S)): Observable; export function first(this: Observable, predicate: (value: T, index: number, source: Observable) => boolean, resultSelector: void, defaultValue?: T): Observable; -export function first(this: Observable, predicate: (value: T, index: number, source: Observable) => value is S, resultSelector: void, defaultValue?: S): Observable; +export function first(this: Observable, + predicate: ((value: T, index: number, source: Observable) => boolean) | + ((value: T, index: number, source: Observable) => value is S), + resultSelector?: ((value: S, index: number) => R) | void, + defaultValue?: S): Observable; export function first(this: Observable, predicate?: (value: T, index: number, source: Observable) => boolean, resultSelector?: (value: T, index: number) => R, defaultValue?: R): Observable; /* tslint:disable:max-line-length */ export function first(this: Observable, predicate?: (value: T, index: number, source: Observable) => boolean,