Skip to content

Commit

Permalink
feat(last): 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 3aa1988 commit 07ecd5e
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/operator/last.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,15 @@ import { EmptyError } from '../util/EmptyError';
* @owner Observable
*/
/* tslint:disable:max-line-length */
export function last<T>(this: Observable<T>, predicate?: (value: T, index: number, source: Observable<T>) => boolean): Observable<T>;
export function last<T, S extends T>(this: Observable<T>, predicate?: (value: T, index: number, source: Observable<T>) => value is S): Observable<S>;
export function last<T, S extends T>(this: Observable<T>,
predicate?: ((value: T, index: number, source: Observable<T>) => boolean) |
((value: T, index: number, source: Observable<T>) => value is S)): Observable<S>;
export function last<T>(this: Observable<T>, predicate: (value: T, index: number, source: Observable<T>) => boolean, resultSelector: void, defaultValue?: T): Observable<T>;
export function last<T, S extends T>(this: Observable<T>, predicate: (value: T, index: number, source: Observable<T>) => value is S, resultSelector: void, defaultValue?: S): Observable<S>;
export function last<T, S extends T, R>(this: Observable<T>,
predicate: ((value: T, index: number, source: Observable<T>) => boolean) |
((value: T, index: number, source: Observable<T>) => value is S),
resultSelector?: ((value: S, index: number) => R) | void,
defaultValue?: S): Observable<S>;
export function last<T, R>(this: Observable<T>, predicate?: (value: T, index: number, source: Observable<T>) => boolean, resultSelector?: (value: T, index: number) => R, defaultValue?: R): Observable<R>;
/* tslint:disable:max-line-length */
export function last<T, R>(this: Observable<T>, predicate?: (value: T, index: number, source: Observable<T>) => boolean,
Expand Down

0 comments on commit 07ecd5e

Please sign in to comment.