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

154
Vistas
JSDoc - Documentation for object property that is defined later

How to document an object property/method, when this property/method gets added to the object later, after the object has been initialized?

Example:

Let's say that I declare the following object. Documentation of ID and name work fine:

let AppUser = {
   /** The user's id */
   ID: 0,
   /** The user's name */
   name: "guest",
};

Later, I decide to add a property (let's say in another js file):

/** The role of the AppUser */
App.role = "admin";

In that case, App.role 's documentation does not work. At least, VSCode does not open the tooltip to inform me about its description.

What I do now, is declare an empty property inside the object: role:null, and also writing its documentation. This workaround works OK.

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