1

Is there a lettable operator for Observable.create() imported from rxjs/Observable?

I already replaced the Observable.of() also imported from rxjs/Observable by the lettable operator of() imported from rxjs/observable/of.

But I could not find a lettable operator for the first issue, anyone who could help?

EDIT: Not a duplicate, this question is about using Observable.create() as a lettable operator, and not about importing and using lettable static operators as Observable.of()

maxhoefler
  • 136
  • 2
  • 10
  • 1
    I don't think there is any. Methods such as `Observable.of()` or `Observable.from()` had to be added by patching the prototype but `Observable.create()` is a static method already https://github.com/ReactiveX/rxjs/blob/master/src/Observable.ts#L58 – martin Nov 29 '17 at 12:41
  • Possible duplicate of [Import of lettable operators and observable creation methods](https://stackoverflow.com/questions/47189540/import-of-lettable-operators-and-observable-creation-methods) – Jota.Toledo Nov 29 '17 at 13:10

1 Answers1

0

There's no lettable operator for Observable.create. It is part of the class definition so it can be used just by importing Observable itself without it creating the problems that lettable operators solved (import fall through, tree shaking and so on).

So either

TypeScript:

    import { Observable } from 'rxjs/Observable';
    ...
    Observable.create(...)

Or as a normal lib

    Rx.Observable.create(...)

Would do just fine :)

Roy Art
  • 578
  • 5
  • 10
  • Just noticed martin had answered this question very similarly quite a while ago. The link he provided is no longer valid, though. Here's the current link to the same place: https://github.com/ReactiveX/rxjs/blob/master/src/internal/Observable.ts#L58 – Roy Art Jan 27 '18 at 13:11