Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

176
Vistas
How can I preserve the JSDoc on re-assignment in VSCode?

A project I am on uses plugins, which export objects, and have their properties re-assigned to centralise functions.

Here is an example:

// barPlugin.js
const barPlugin = {
  /**
   * Register a Foo
   * @param {string} name of the foo
   * @param {object} options the options that make this foo special
   * @param {string} options.flavour how the foo tastes
   * @param {boolean} options.levitate if the foo can levitate
   */
  registerFoos: (name, options = {}) => {
     // stuff that registers foos
  }
  // other bar plugin related functions
}
export default barPlugin;

// pluginHub.js
const allPlugins = {};
export const initialisePlugins = () => { // called on app load
  // hovering over 'registerFoos' on the LHS of the assignment does not show the jsdoc
  allPlugins.registerFoos = barPlugin.registerFoo; 
  // LOTS of other examples of the above
}
export default allPlugins;

This is also so that when we need to register/interact with the foos registered via the barPlugin we only need to know it's foos and not which of the many many plugins it's from.

The issue, now that we have started using JSDoc is that it seems like importing allPlugins and calling allPlugins.registerFoos no longer has the JSDoc associated with it?

// nonPluginCode.js
import allPlugins from 'pluginsHub';

allPlugins.registerFoos( ... ) // hovering over 'registerFoos' does not show the jsdoc

It feels like this might be an issue with VSCode, but regardless how can I preserve the JSDoc across the reassignment?

It's not JSDoc broken on `exports.default` in VSCode? as this happens before exporting.

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda