component.ts
initialize() method says
Argument of type 'unknown[]' is not assignable to parameter of type 'OperatorFunction<unknown[], unknown>'. Type 'unknown[]' provides no match for the signature '(source: Observable<unknown[]>): Observable'
alertsChanged$: Observable<AlertModel[]>;
private initialize(): void {
this.alertsChanged$ = this.alertsService.getAlerts().pipe(
map((res) => res), // here it returns the above error
tap((res) => {
this.setDataForFilters(res); //Argument of type 'unknown' is not assignable to parameter of type 'AlertModel[]'.
}),
);
}
private setDataForFilters(alerts: AlertModel[]): void {}
service.ts
// no issues here
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 let me the issue here?