component.ts
initialize()
method explains
The error message says 'Argument of type 'unknown[]' is not assignable to parameter of type 'OperatorFunction<unknown[], unknown>'. Type 'unknown[]' does not match the signature '(source: Observable<unknown[]>): Observable'
alertsChanged$: Observable<AlertModel[]>;
private initialize(): void {
this.alertsChanged$ = this.alertsService.getAlerts().pipe(
map((res) => res), // encountered the above mentioned error here
tap((res) => {
this.setDataForFilters(res); //The argument of type 'unknown' cannot be assigned to a parameter of type 'AlertModel[]'
}),
);
}
private setDataForFilters(alerts: AlertModel[]): void {}
service.ts
// no problems found in this section
getAlerts(): Observable<AlertModel[]> {
return this.angularFireDatabase
.list<AlertModel>(`groups/${this.groupId}/alerts`)
.valueChanges()
.pipe(
map((res) => orderBy(res, ['timeStamp'], ['desc'])),
first()
);
}
.html
<app-alerts
[alerts]="alertsChanged$ | async"
></app-alerts>
Please assist me in resolving this issue.