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