Un proyecto en el que estoy usa complementos, que exportan objetos y tienen sus propiedades reasignadas para centralizar funciones.
Aquí hay un ejemplo:
// 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; Esto también es para que cuando necesitemos registrarnos/interactuar con los foos registrados a través de barPlugin , solo necesitemos saber que son foos y no de cuál de los muchos complementos proviene.
El problema, ahora que comenzamos a usar JSDoc, es que parece que importar todos los allPlugins.registerFoos allPlugins no tiene el JSDoc asociado.
// nonPluginCode.js import allPlugins from 'pluginsHub'; allPlugins.registerFoos( ... ) // hovering over 'registerFoos' does not show the jsdocParece que esto podría ser un problema con VSCode, pero independientemente de cómo puedo conservar el JSDoc durante la reasignación.
¿No está roto JSDoc en `exports.default` en VSCode? ya que esto sucede antes de exportar.