Closed acheshkov closed 5 years ago
yes, behaviorSubject
does not override create
so it doesn't return instance of behaviorsubject. @blesh is this intended, or just oversight that need to be updated?
edited: looking into RxJS4 impl, it seems create
is not expected to be exposed to behaviorSubject or some other variants.
To me, this seems like a similar problem to https://github.com/ReactiveX/rxjs/issues/1876 and https://github.com/ReactiveX/rxjs/issues/1829 with static operators not deferring to the current class type.
We may decide that subjects do not have these static operators on principle, but technically speaking I think it might be valuable if we could support it.
so suggestions to support variant of creation method as similar to of
or etcs? I'm ok with that PR was created for simple alignment of interfaces (and at least get rid of unexpected creation method behavior).
I'm personally OK with accepting your https://github.com/ReactiveX/rxjs/pull/1894 PR to fix this bug and then add new functionality later, if we choose to do so. That seems like a much longer conversation and I don't want it to block v5.0.0 release.
I'm personally OK with accepting your #1894 PR
: makes sense, let's continue discussion in PR if it's acceptable or not (including details of implementation as well). We could leave this issue opened for further goals if PR's agreed to check in.
This was an oversight. It should have the same arguments as the constructor and return a BehaviorSubject
create
static methods are going away. This is obsolete.
RxJS version: 5.0.0-beta.9
Code to reproduce:
` var a = new Rx.BehaviorSubject('start');
var b = Rx.BehaviorSubject.create(a, new Rx.Observable(o => { a.subscribe(o); }));
console.log(b.getValue());
`
Expected behavior: // output: start
Actual behavior:
Uncaught TypeError: getValue is not a function
Additional information: