Closed jdgamble555 closed 2 years ago
I'm not sure if this has changed but you can convert any spec-compliant Observable to an RxJS Observable using from
.
The toObservable
operator outputs a spec-compliant ECMAScript Observable so converting it should be as simple as for any other spec-compliant observable.
Hmm, I am getting this:
import { pipe, toObservable } from 'wonka';
import { from } from 'rxjs';
...
from(
pipe(
this.client.subscription(q),
toObservable
)
);
ERROR TypeError: You provided an invalid object where a stream was expected.
You can provide an Observable, Promise, Array, or Iterable.
And I get this type error if I don't force an any
type:
Argument of type 'observableT<any>' is not assignable to parameter of type 'ObservableInput<any>'
Got it: zen-observable
, which is already needed for urql to work in Angular:
Is it possible to convert the observable to an rxjs observable?
This would be the desired behavior from an urql subscription:
This seems like a lot more complicated to write every time:
Also, in Angular, if I use the observable in the template, I get this error:
So, I hacked it using this, although it seems like there should be an easier way without this hack:
Then I use test in my template...
Is this the only way?