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

146
Views
¿Cómo entiendes las interfaces de funciones de WebStorm?

Tengo problemas para entender algunas funciones y sus interfaces. ES DECIR:

 ReadonlyArray<unknown>.map( callbackfn: (value: unknown, index: number, array: unknown[]) => unknown, thisArg?: any): unknown[]

Esto es lo que muestra WebStorm cuando paso el mouse sobre una función .map() . Entiendo que .map() toma una función de devolución de llamada específica como parámetro, pero ¿qué => unknown y thisArg?: any represent?

Del mismo modo, cuando paso el cursor sobre una función forEach() , la ventana emergente se ve así:

 ReadonlyArray<unknown>.forEach( callbackfn: (value: unknown, index: number, array: unknown[]) => void, thisArg?: any): void

forEach también toma una función de devolución de llamada como parámetro, pero ¿qué representa => void, thisArg?: any): void ?

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

0

// the `.map` function is member of the generic type ReadonlyArray<unknown>. Where unknown is the type of the elements of the array ReadonlyArray<unknown>.map( // first argument is a callback function. The first argument of the callback is value, of type unknown, the second is index of type number, and so on callbackfn: (value: unknown, index: number, array: unknown[]) // this parts means that the callback should return a value of type unknown => unknown, // .map takes a second arguments called thisArg of any type. The ? means that the argument is optional thisArg?: any) // .map returns an array of type unknown : unknown[]

El tipo es desconocido porque depende del tipo de los elementos presentes en la matriz en la que se aplica .map . Si es una matriz de objetos, el tipo desconocido será object

De manera similar, forEach toma un primer argumento que es una devolución de llamada. Pero la devolución de llamada no devuelve nada, por lo tanto, tiene => void .

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!