Skip to content

Commit

Permalink
fix(typings): remove redundant generics from call<T, R> and lift<T, R>
Browse files Browse the repository at this point in the history
  • Loading branch information
masaeedu authored and kwonoj committed Feb 10, 2016
1 parent 835b9e9 commit 603c9eb
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/Observable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export class Observable<T> implements CoreOperators<T> {
* @description creates a new Observable, with this Observable as the source, and the passed
* operator defined as the new observable's operator.
*/
lift<T, R>(operator: Operator<T, R>): Observable<R> {
lift<R>(operator: Operator<T, R>): Observable<R> {
const observable = new Observable<R>();
observable.source = this;
observable.operator = operator;
Expand Down
2 changes: 1 addition & 1 deletion src/Operator.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {Subscriber} from './Subscriber';

export class Operator<T, R> {
call<T, R>(subscriber: Subscriber<R>): Subscriber<T> {
call<R>(subscriber: Subscriber<R>): Subscriber<T> {
return new Subscriber<T>(subscriber);
}
}
4 changes: 2 additions & 2 deletions src/operator/combineLatest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export function combineLatest<T, R>(...observables: Array<ObservableInput<any> |

observables.unshift(this);

return new ArrayObservable(observables).lift<T, R>(new CombineLatestOperator<T, R>(project));
return new ArrayObservable(observables).lift(new CombineLatestOperator(project));
}

/* tslint:disable:max-line-length */
Expand Down Expand Up @@ -107,7 +107,7 @@ export function combineLatestStatic<T, R>(...observables: Array<any | Observable
observables = <Array<Observable<any>>>observables[0];
}

return new ArrayObservable(observables, scheduler).lift<T, R>(new CombineLatestOperator<T, R>(project));
return new ArrayObservable(observables, scheduler).lift(new CombineLatestOperator<T, R>(project));
}

export class CombineLatestOperator<T, R> implements Operator<T, R> {
Expand Down
2 changes: 1 addition & 1 deletion src/operator/concat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,5 @@ export function concatStatic<T, R>(...observables: Array<Observable<any> | Sched
scheduler = args.pop();
}

return new ArrayObservable(observables, scheduler).lift<Observable<T>, T | R>(new MergeAllOperator<T | R>(1));
return new ArrayObservable(observables, scheduler).lift(new MergeAllOperator<T | R>(1));
}
2 changes: 1 addition & 1 deletion src/operator/merge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@ export function mergeStatic<T, R>(...observables: Array<Observable<any> | Schedu
return <Observable<R>>observables[0];
}

return new ArrayObservable<Observable<T>>(<any>observables, scheduler).lift<Observable<T>, R>(new MergeAllOperator<R>(concurrent));
return new ArrayObservable(<any>observables, scheduler).lift(new MergeAllOperator<R>(concurrent));
}
6 changes: 4 additions & 2 deletions src/operator/mergeMapTo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@ export function mergeMapTo<T, R, R2>(observable: Observable<R>,
return this.lift(new MergeMapToOperator(observable, <any>resultSelector, concurrent));
}

// TODO: Figure out correct signature here: an Operator<Observable<T>, R2>
// needs to implement call(observer: Subscriber<R2>): Subscriber<Observable<T>>
export class MergeMapToOperator<T, R, R2> implements Operator<Observable<T>, R2> {
constructor(private ish: Observable<R> | Promise<R>,
private resultSelector?: (outerValue: T, innerValue: R, outerIndex: number, innerIndex: number) => R2,
private concurrent: number = Number.POSITIVE_INFINITY) {
}
}

call(observer: Subscriber<R2>): Subscriber<T> {
call(observer: Subscriber<R2>): Subscriber<any> {
return new MergeMapToSubscriber(observer, this.ish, this.resultSelector, this.concurrent);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/operator/zip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export function zipStatic<T, R>(...observables: Array<ObservableInput<any> | ((.
if (typeof project === 'function') {
observables.pop();
}
return new ArrayObservable(observables).lift<T, R>(new ZipOperator<T, R>(project));
return new ArrayObservable(observables).lift(new ZipOperator(project));
}

export class ZipOperator<T, R> implements Operator<T, R> {
Expand Down

0 comments on commit 603c9eb

Please sign in to comment.