I have somewhat of the following code:
export class Logger {
constructor(label = null, options = {}) {
if (!winston.loggers.has(label)) {
winston.loggers.add(
label,
{ /* ...default options */ }
);
}
return winston.loggers.get(label);
}
// some other function...
}
Here, my class returns a custom object which is a Winston logger object. But when I import this class in my other files and create a new object with it (const logger = new Logger()
), the auto-suggestion show only the function in the class i.e // some other function
.
Now, since my class returns a Winston logger instance, I want to be able to document it with JS doc so that I get my auto-suggestion back.
Is there a way I can achieve this with JS doc, to define a custom type of object that an already defined class returns?