Skip to content

Commit

Permalink
fix(pipe): replace rest parameters overload
Browse files Browse the repository at this point in the history
Replace the rest parameters overload with a signature that also includes
the A-I type parameters.

Closes ReactiveX#3823 ReactiveX#3841
  • Loading branch information
cartant committed Jul 23, 2018
1 parent 33dd17c commit 96e2add
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
4 changes: 0 additions & 4 deletions spec-dtslint/Observable-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,6 @@ describe('pipe', () => {
const o = of('foo').pipe(a('1'), a('2'), a('3'), a('4'), a('5'), a('6'), a('7'), a('8'), a('9'), a('10')); // $ExpectType Observable<{}>
});

it('should support an explicit type parameter for more than 9 arguments', () => {
const o = of('foo').pipe<string>(a('1'), a('2'), a('3'), a('4'), a('5'), a('6'), a('7'), a('8'), a('9'), a('10')); // $ExpectType Observable<string>
});

it('should enforce types for the 1st argument', () => {
const o = of('foo').pipe(a('#', '1')); // $ExpectError
});
Expand Down
4 changes: 2 additions & 2 deletions src/internal/Observable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ export class Observable<T> implements Subscribable<T> {
pipe<A, B, C, D, E, F, G>(op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>, op5: OperatorFunction<D, E>, op6: OperatorFunction<E, F>, op7: OperatorFunction<F, G>): Observable<G>;
pipe<A, B, C, D, E, F, G, H>(op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>, op5: OperatorFunction<D, E>, op6: OperatorFunction<E, F>, op7: OperatorFunction<F, G>, op8: OperatorFunction<G, H>): Observable<H>;
pipe<A, B, C, D, E, F, G, H, I>(op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>, op5: OperatorFunction<D, E>, op6: OperatorFunction<E, F>, op7: OperatorFunction<F, G>, op8: OperatorFunction<G, H>, op9: OperatorFunction<H, I>): Observable<I>;
pipe<R>(...operations: OperatorFunction<any, any>[]): Observable<R>;
pipe<A, B, C, D, E, F, G, H, I, R>(op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>, op5: OperatorFunction<D, E>, op6: OperatorFunction<E, F>, op7: OperatorFunction<F, G>, op8: OperatorFunction<G, H>, op9: OperatorFunction<H, I>, ...operations: OperatorFunction<any, any>[]): Observable<R>;
/* tslint:enable:max-line-length */

/**
Expand All @@ -318,7 +318,7 @@ export class Observable<T> implements Subscribable<T> {
* .subscribe(x => console.log(x))
* ```
*/
pipe<R>(...operations: OperatorFunction<T, R>[]): Observable<R> {
pipe<R>(...operations: OperatorFunction<any, any>[]): Observable<R> {
if (operations.length === 0) {
return this as any;
}
Expand Down

0 comments on commit 96e2add

Please sign in to comment.