Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
MSakamaki opened this issue Apr 16, 2018 · 7 comments

Comments

@MSakamaki
Copy link

MSakamaki commented Apr 16, 2018

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.
angular/angular-cli#10336

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

It seems to be caused by this patch #3562

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

@cartant
Copy link
Collaborator

cartant commented Apr 16, 2018

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.

@cartant
Copy link
Collaborator

cartant commented Apr 16, 2018

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

@filipesilva
Copy link
Contributor

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

@cartant
Copy link
Collaborator

cartant commented Apr 16, 2018

@filipesilva Yes, it should be, but I suspect that no compile-time error is effected because of microsoft/TypeScript#18757.

@filipesilva
Copy link
Contributor

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

@benlesh
Copy link
Member

benlesh commented Apr 26, 2018

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

@benlesh benlesh closed this as completed Apr 26, 2018
@lock
Copy link

lock bot commented Jun 5, 2018

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.

@lock lock bot locked as resolved and limited conversation to collaborators Jun 5, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants