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

429
Views
El tipo 'objeto' debe tener un método 'Symbol.iterator' que devuelva un iterador

data.technologies es una matriz y me gustaría obtener el resultado de esa matriz.

Así es como se ve la salida de data.technologies :

ingrese la descripción de la imagen aquí

 this.profileService.getEntities().subscribe(data => { for (const technology of data.technologies) { console.log(technology); } });

El tipo de getEntities() es Observable<IprofileData> .

 export interface IprofileData { technologies: object; }

TypeScript me da el error:

TS2488: el tipo 'objeto' debe tener un método 'Symbol.iterator' que devuelva un iterador.

¿Qué estoy haciendo mal?

over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

Para futuros googleadores:

Este es también el mensaje de error devuelto si olvida objetivar las entradas de su función.

Ejemplo:

 setCurrRowData(...currRowData, sort_order: num);

Arreglar:

 setCurrRowData( { ...currRowData, sort_order: num } ); // ^ ^
over 4 years ago · Santiago Trujillo Report

0

La estructura de tiempo de ejecución es correcta, es una matriz, pero el tipo dice (de su comentario) que es solo un objeto. El objeto no tiene protocolo iterador, la matriz sí.

Tipo de ejemplo que debería satisfacer la necesidad:

 type Data { ...// some other props technologies: string[] // change string into any type you have there }
over 4 years ago · Santiago Trujillo Report

0

¿ data.technologies es una función (usted mencionó que "devolvió" una matriz)? Si es así, simplemente necesita llamarlo así:

 this.profileService.getEntities().subscribe(data => { for (const technology of data.technologies()) { console.log(technology); } });
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!