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

588
Views
Rechazo no controlado (TypeError): intento no válido de difundir una instancia no iterable, ¿cómo puedo solucionarlo?

Tengo un error como este en mi proyecto:

Rechazo no controlado (TypeError): intento no válido de difundir una instancia no iterable. Para ser iterables, los objetos que no son de matriz deben tener un método Symbol.iterator

Aquí está mi código SortContracts.ts:

 function sortContracts( contracts: ContractUsage[], sortField?: SortType, sortDirection?: SortDirection ): any[] { let sortFunction:any switch (sortField) { // Sort by End Date case SortType.DATE_SORT: if (sortDirection === SortDirection.ASC) { // Sort by End Date ASC sortFunction = (a:any, b:any) => endDateSortAscFunc(a, b); } else { // Sort by End Date DESC sortFunction = (a:any, b:any) => endDateSortDescFunc(a, b); } break; // Sort by ContractID case SortType.CONTRACT_SORT: if (sortDirection === SortDirection.ASC) { // Sort by ContractID ASC sortFunction = (a:any, b:any) => contractIdSortAscFunc(a, b); } else { // Sort by ContractID DESC sortFunction = (a:any, b:any) => contractIdSortDescFunc(a, b); } break; case SortType.USAGE_ORDER: if (sortDirection === SortDirection.ASC) { sortFunction = (a:any, b:any) => usageOrderSortAscFunc(a, b); } else { sortFunction = (a:any, b:any) => usageOrderSortDescFunc(a, b); } break; // default sort default: sortFunction = (a:any, b:any) => contractIdSortAscFunc(a, b); } // Return the sorted contracts console.log('contract here: ', [...contracts].sort(sortFunction)) return [...contracts].sort(sortFunction); }

ingrese la descripción de la imagen aquí

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

La variable que está tratando de difundir (es decir, [...contracts] ) no es iterable . Si desea utilizar este operador, debe tener esta variable iterable . Verifique la variable si es realmente una matriz (o cualquier otro tipo iterable) y si no es nula o indefinida .

about 4 years ago · Juan Pablo Isaza 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!