I have the following code, in which I wanna override the next to have some custom logic. It doesn't work this way, but only works if the next is a property with an arrow function. What's the reason behind it?
export class Store<T> extends ReplaySubject<T | undefined> {
next(value?: T) {
console.log("do something in my code");
super.next(value);
}
}
export class Store<T> extends ReplaySubject<T | undefined> {
next = (value?: T) => {
console.log("do something in my code");
super.next(value);
};
}
https://stackblitz.com/edit/typescript-override-subject-next