Skip to content

Commit

Permalink
fix(catch): return type is now the union of input types (#2478)
Browse files Browse the repository at this point in the history
returned type is the union of inputs type
  • Loading branch information
ghetolay authored and benlesh committed Apr 3, 2017
1 parent f72b9aa commit 840def0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/operator/catch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,13 @@ import { subscribeToResult } from '../util/subscribeToResult';
* @name catch
* @owner Observable
*/
export function _catch<T, R>(this: Observable<T>, selector: (err: any, caught: Observable<T>) => ObservableInput<R>): Observable<R> {
export function _catch<T, R>(this: Observable<T>, selector: (err: any, caught: Observable<T>) => ObservableInput<R>): Observable<T | R> {
const operator = new CatchOperator(selector);
const caught = this.lift(operator);
return (operator.caught = caught);
}

class CatchOperator<T, R> implements Operator<T, R> {
class CatchOperator<T, R> implements Operator<T, T | R> {
caught: Observable<T>;

constructor(private selector: (err: any, caught: Observable<T>) => ObservableInput<T | R>) {
Expand All @@ -86,7 +86,7 @@ class CatchOperator<T, R> implements Operator<T, R> {
* @ignore
* @extends {Ignored}
*/
class CatchSubscriber<T, R> extends OuterSubscriber<T, R> {
class CatchSubscriber<T, R> extends OuterSubscriber<T, T | R> {
constructor(destination: Subscriber<any>,
private selector: (err: any, caught: Observable<T>) => ObservableInput<T | R>,
private caught: Observable<T>) {
Expand Down

0 comments on commit 840def0

Please sign in to comment.