I have developed my own Observable service implementation
import { Injectable, EventEmitter, Output} from '@angular/core';
@Injectable()
export class CustomObservableService {
data = [];
@Output eventEmitter:EventEmitter = new EventEmitter();
setSharedData(key, value) {
this.data[key] = value;
this.eventEmitter.emit(this.data);
}
getSharedData() {
return this.data;
}
}
Here is an example of how to use it:
ngOnInit() {
this._observable.eventEmitter.subscribe((data) => {
console.log(data);
})
}
During compilation, an error message appears:
app/services/data-observable.service.ts(6,5): error TS1240: Unable to resolve signature of property decorator when called as an expression.
Supplied parameters do not match any signature of call target.
The specific issue mentioned in the error points to this line of code:
@Output eventEmitter:EventEmitter = new EventEmitter();
Despite the error, the service functions correctly. Any insights on what might be wrong?