ReactiveX / ReactiveX/rxjs

pipe does not properly support rest parameters in some cases.

Open
#4,177 10 comments 4 reactions 1 assignee View on GitHub

@benlesh is already working on this.

Since Sep 24, 2018.

feature
Dominant language
TypeScript
Stars
31.7k
Forks
3k
PR merge metrics
No merged PRs in 30d

Description

I encountered this while updating Angular CLI.

In particular, the update to the base.ts file in there, where I'm adding as any was necessary because the spreading of an array of operators into pipe was not working.

EDIT: It seems that we can't support rest params without breaking inference enforcement from operator to operator in the pipe. So here's a proposal:

Proposed Feature

Add an overload of pipe that accepts OperatorFunction<any, any>[] and returns Observable<R>:

pipe<R>(operations: OperationFunction<any, any>[]): Observable<R>;

// usage

const operations = [map(x => x + x), filter(x => x < 100), mergeMap(n => timer(n))];

of(42).pipe(operations)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.