Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

385
Views
El argumento de tipo 'desconocido[]' no se puede asignar a un parámetro de tipo > 'OperatorFunction

componente.ts

método initialize() dice

El argumento de tipo 'desconocido[]' no se puede asignar al parámetro de tipo 'OperatorFunction<desconocido[], desconocido>'. El tipo 'desconocido[]' no proporciona ninguna coincidencia para la firma '(fuente: Observable<desconocido[]>): 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 {}

servicio.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>

Por favor, déjame el problema aquí?

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

Encontré el problema aquí. Era un conflicto con el Lodash map Lodash y RxJS map . es decir, el código VS no importó el mapa RxJS debido al mapa Lodash y dio el error anterior debido a eso.

Como necesito usar ambos en el mismo componente, lo he hecho así.

 import { finalize, tap, map } from 'rxjs/operators'; import { map as lodashMap } from 'lodash';
over 4 years ago · Santiago Trujillo Report

0

El mismo tipo de error vendrá si usamos las importaciones de 'rxjs' y "rxjs/operators" al mismo tiempo. En mi caso este fue el código,

 this.anApiCall.getAdata(this.id) .pipe(map(res => this.dataUtil.parseToForm(this.id, res)), onErrorResumeNext(of(this.dataUtil.newForm(this.id)))) .pipe(tap(frm => this.form = frm)) .subscribe();

Estaba usando el operador 'onErrorResumeNext' pero, desafortunadamente, IDE importó la función de 'rxjs' en lugar de rxjs/operators.

 import { onErrorResumeNext } from "rxjs"; // if the import is like this then you will get error like 'Argument of type 'Observable<YourType>' is not assignable to parameter of type 'OperatorFunction<unknown, unknown>'.'

Así que verifique que la importación sea de 'rxjs/operadores' o no. y cambiar la importación como

 import { map, tap, onErrorResumeNext } from "rxjs/operators";
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!