You don’t need to define Partial; with versions 2.1 and later, it’s part of TypeScript:

* Make all properties in T optional
type Partial<T> = {
[P in keyof T]?: T[P];

And, yes, using PartialObserver allows for next to not be implemented. Choosing whether or not to implement it is up to whomever is passing the observer. Obviously, it wouldn’t receive next notifications without a next method, but it’s not an actual error as far as subscribe is concerned. And I didn’t see the need to enforce a contract that subscribe itself didn’t enforce. It is true that using NextObserver would make some sense here, but in general, when connecting observables in this way, I would opt for a PartialObserver, as sometimes the provider of the observer might only be interested in a complete notification, etc.

It would be an entirely different matter if the receiver of the observer were to be explicitly calling next, but that’s not the case here — it’s just passed to subscribe.

RxJS core team member; front-end developer; mentor; speaker; open-source contributor

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store