-
Yep, I know it's an internal detail, but I'd like to understand what is the purpose of it. I also posted a comment on #5431 asking this, but I think it fits more in discussions instead, as it's a general question. When creating custom operators, a simple signature looks like const myOperator = <T>(arg1: number) => (source: Observable<T>) => new Observable(
subscriber => {
return source.subscribe(/*...*/);
}
) However, all internal operators use Now, from @benlesh 's post in #5431 I understand that class CustomObservable<T> extends Observable<T> {
specialMethod(): void { }
}
const custom = new CustomObservable<T>;
custom.filter(fn).map(fn2).mergeMap(fn3).specialMethod() However, if I transform this code to v6 or v7, that class CustomObservable extends Observable {
specialMethod() { }
}
const custom = new CustomObservable();
console.log(
map(x => x)(custom).specialMethod
); This I started learning rxjs on v5, and the way we created custom functions and operators was by polluting the Observable's interface. Something like: // Don't use this please
Observable.prototype.specialMethod = (): void => {} So I never really used lift. But from the looks of it, even the internal use looks redundant and maybe it makes things a bit harder to follow? Why are rxjs/operators using Edit: Obligatory meme |
Beta Was this translation helpful? Give feedback.
#60