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

323
Views
Documente el parámetro de función desestructurada opcional en JSDoc, con verificación de tipo vscode

El parámetro de función desestructurada del documento de pregunta en JSDoc sugiere esto, pero no pregunta explícitamente sobre el parámetro opcional en la pregunta. Y también, ¿no creo que estén usando la verificación de tipo VSCode?

Recibo este error cuando VSCode está revisando mi proyecto de JavaScript por mí:

(parámetro) rechazarMsg: cadena
Al tipo '{}' le faltan las siguientes propiedades del tipo ' { rejectMsg: string; windowSize: number; stallLimit: number; } ': mensaje de rechazo, tamaño de ventana, límite de parada ts(2739)

El código en cuestión es:

 /** * Function that wraps the on 'data' callback of a Stream, and monitors for 'stalling'. * * @param {(data)=>void} [successCb] callback run on successful chunk of data * @param {{rejectMsg: string, windowSize: number, stallLimit: number}} [param1] options * @returns {(data)=>void} */ const stallGuard = (successCb = () => { }, { rejectMsg = 'Stalled', windowSize = 5, stallLimit = windowSize } = {}) => { // code goes here }

Si no pongo el parámetro predeterminado para esas opciones ( = {} ), entonces vomita cuando llamo sin pasar ninguna opción.

¿Hay alguna manera de satisfacer la verificación de tipo para esto?

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