We use angular (11.2.14) and we updated rxjs library to 7.1.0. From that point we have this error "Property 'observers' does not exist on type 'EventEmitter'" in multiple places. According to the PR's we found (https://github.com/ReactiveX/rxjs/pull/6405#issue-645234112) there should be a property observed but it's not available since we are working with an EventEmitter instead of a Subject.
The error appears on build.
@Output() readonly onListCreate: EventEmitter<ListDto> = new EventEmitter(); // our emitter
createList() {
if (!this.newListName) {
return;
}
this.ListService.createList(this.newListName).subscribe((newList) => {
const newListViewModel: ListViewModel = {
id: newList.id,
name: this.newListName,
isAdded: false,
};
this.addModuleToList(newList, newListViewModel);
this.newListName = "";
if (this.onListCreate.observers.length === 0) { // error appears here
this.listsViewModel.push(newListViewModel);
this.ownedAndCoOwnedLists.push(newList);
}
this.onListCreate.emit(newList);
});
}