Rxjs: You provided xxxx where a stream was expected. will be generated in 6.0.0-uncanny-rc.7

Created on 16 Apr 2018  路  7Comments  路  Source: ReactiveX/rxjs

RxJS version:

  • 6.0.0-ucandoit-rc.6
  • 6.0.0-uncanny-rc.7

Code to reproduce:

  • typescript code
import { range, from, concat } from 'rxjs';
import { reduce } from 'rxjs/internal/operators';

concat(
  from(['A','B','C']),
  reduce(()=> { 
    console.log('reduce?');
  }),
).subscribe(
  r => console.log('next', r),
  e => console.error('error', e),
  () => console.log('CMPLITE'),
);

Expected behavior:

version wants the same behavior in 6.0.0-ucandoit-rc.6 and 6.0.0-uncanny-rc.7

Actual behavior:

Version 6.0.0-uncanny-rc.7 raises the following exceptions

> ts-node index.ts

next A
next B
next C
error TypeError: You provided 'function reduceOperatorFunction(source) {
        return pipe_1.pipe(scan_1.scan(function (acc, value, index) {
            return accumulator(acc, value, index + 1);
        }), takeLast_1.takeLast(1))(source);
    }' where a stream was expected. You can provide an Observable, Promise, Array, or Iterable.
    at Object.exports.subscribeTo (/Users/test/project/work/rx-test/node_modules/rxjs/src/internal/util/subscribeTo.ts:37:11)
    at Object.subscribeToResult (/Users/test/project/work/rx-test/node_modules/rxjs/src/internal/util/subscribeToResult.ts:18:10)
    at MergeMapSubscriber._innerSub (/Users/test/project/work/rx-test/node_modules/rxjs/src/internal/operators/mergeMap.ts:139:14)
    at MergeMapSubscriber._tryNext (/Users/test/project/work/rx-test/node_modules/rxjs/src/internal/operators/mergeMap.ts:135:10)
    at MergeMapSubscriber._next (/Users/test/project/work/rx-test/node_modules/rxjs/src/internal/operators/mergeMap.ts:119:12)
    at MergeMapSubscriber.Subscriber.next (/Users/test/project/work/rx-test/node_modules/rxjs/src/internal/Subscriber.ts:102:12)
    at Observable._subscribe (/Users/test/project/work/rx-test/node_modules/rxjs/src/internal/util/subscribeToArray.ts:9:16)
    at Observable._trySubscribe (/Users/test/project/work/rx-test/node_modules/rxjs/src/internal/Observable.ts:216:19)
    at Observable.subscribe (/Users/test/project/work/rx-test/node_modules/rxjs/src/internal/Observable.ts:198:87)
    at MergeMapOperator.call (/Users/test/project/work/rx-test/node_modules/rxjs/src/internal/operators/mergeMap.ts:94:19)

Additional information:

The related issues are as follows.
https://github.com/angular/angular-cli/issues/10336

From 6.0.0-uncanny-rc.7, the following process seems to fail.

It seems to be caused by this patch https://github.com/ReactiveX/rxjs/pull/3562

The cause of the above issues to be due to a similar implementation on devkit side

Most helpful comment

reduce returns an operator function that expects to be passed an Observable; it does not return an ObservableInput, so the code in the issue's snippet is incorrect.

PR #3562 has exposed an error, rather than introduced one.

All 7 comments

reduce returns an operator function that expects to be passed an Observable; it does not return an ObservableInput, so the code in the issue's snippet is incorrect.

PR #3562 has exposed an error, rather than introduced one.

There is a similar error in angular/devkit/.../node-workflow.ts. See this comment.

@cartant should this be a compile-time error when using the rxjs typings?

@filipesilva Yes, it should be, but I suspect that no compile-time error is effected because of https://github.com/Microsoft/TypeScript/issues/18757.

Got it. Yeah that sounds like an unfortunate situation :/

@cartant's answer here is correct. Closing this issue.

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

unao picture unao  路  4Comments

samherrmann picture samherrmann  路  3Comments

chalin picture chalin  路  4Comments

marcusradell picture marcusradell  路  4Comments

jakovljevic-mladen picture jakovljevic-mladen  路  3Comments