question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Incorrect type signatures for concatAll and mergeAll operators

See original GitHub issue

RxJS version: 5.4.2

Code to reproduce:

const fromEvent = Rx.Observable.fromEvent;
const mouseEvents = Rx.Observable.of([fromEvent(document, "click"), fromEvent(document, "mouseenter"), fromEvent(document, "mouseleave")]); 

mouseEvents.concatAll().mapTo(null);
mouseEvents.mergeAll().mapTo(null);

Expected behavior: Code compiles without error.

Actual behavior: Type error: "[ts] Property ‘mapTo’ does not exist on type ‘Observable<{}>[]’.

Additional information: Incorrect type signatures are-

function concatAll<T>(this: Observable<T>): T;
function concatAll<T, R>(this: Observable<T>): Subscribable<R>;

function mergeAll<T>(this: Observable<T>, concurrent?: number): T;
function mergeAll<T, R>(this: Observable<T>, concurrent?: number): Subscribable<R>;

They should be (I believe):

function concatAll<T extends ObservableInput<R>, R>(this: Observable<T>): Observable<R>;

function mergeAll<T extends ObservableInput<R>, R>(this: Observable<T>, concurrent?: number): Observable<R>;

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:3
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
benleshcommented, Feb 20, 2018

Closed by #3321

1reaction
tvaldcommented, Aug 5, 2017

Can we please fix this without waiting for a major release? This is an active issue, with two separate PRs to (partially) fix it on master in the last month: #2779, #2760

The existing typings for mergeAll() are wrong and unusable. It should be trivial to drop in the correct typing from #2779: https://github.com/ReactiveX/rxjs/pull/2690/files#diff-287d1762ff7b138d92ddcb79627353f7

Read more comments on GitHub >

github_iconTop Results From Across the Web

concatAll - Learn RxJS
signature : concatAll(): Observable ... Example 1: concatAll with observable ... import { map, concatAll } from 'rxjs/operators';.
Read more >
RxJs custom operator with function as input - Stack Overflow
You'll need a function of type (input: T) => Observable<R> . Which is the same type signature that concatMap already takes.
Read more >
RxJs combination operators - Medium
RxJs combination operators · CombineAll — · ConcatAll — · MergeAll — · Learn to combine RxJs sequences with super intuitive interactive diagrams...
Read more >
RxJS 6.x to 7.x Detailed Change List
The kind property is now readonly . The value property is now readonly and may be undefined . constructor signature now only allows...
Read more >
rxjs/CHANGELOG.md - UNPKG
522, - Type signatures tightened up around `Notification` and `dematerialize`, may uncover issues with invalid types passed to those operators.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found