1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

Argument of type 'unknown[]' is not assignable to parameter of type > 'OperatorFunction

Discussão em 'Angular' iniciado por Sampath, Outubro 11, 2024.

  1. Sampath

    Sampath Guest

    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?

    Continue reading...

Compartilhe esta Página