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

197
Views
Tipo genérico JSDoc - @typedef para WeakRef

¿Cómo implementar typedef para el tipo genérico?

Aquí está el typedef de WeakRef:

 /** * @typedef {Object} WeakRef * @property {function(): any} deref */

aquí está usando, pregunta dentro de la lista:

 export class MyCl { /** * @type {WeakRef} */ #ref; /** * @param {HTMLElement} el */ myMethod(el) { this.#ref = new WeakRef(el); } myMethod2() { let htmlEl = this.#ref.deref(); // <======== // htmlEl here is 'any', it must be 'HTMLElement' }

lo intento

 /** * @typedef {Object} WeakRef * @template T * @property {function(): T} deref */

pero no sé cómo configurar T aquí:

 /** * @type {WeakRef} * how to say T is HTMLElement <======== */ #ref;
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!