I have been playing with Observables
recently, and I came across this constructor definition of the Observable
constructor(subscribe?: (this: Observable<T>, subscriber: Subscriber<T>) => TeardownLogic) {
so it says, that constructor accepts as an argument a callback function that should accept 2 arguments and return TeardownLogic
However, when I try to follow that restriction, I have an error, and only single argument function is accepted.
What is special about this: Observable
? What does that actually mean in constructor context?.
As example:
/// this is invalid, but it is matching the cosntructor definition
new Observable(function (x, y) {
})
//// this is valid
new Observable(function (x) {
})