mirror of
https://github.com/jsdoc/jsdoc.git
synced 2025-12-08 19:46:11 +00:00
When an interface is a) defined as an ES2015 class and b) assigned to a variable, JSDoc sometimes used the wrong `longname` and `memberof` for members of the interface (specifically, for instance properties). The root cause was that we weren't resolving `this` correctly within this type of interface. As a result, if you added a JSDoc comment to something like `this.foo = 'bar'`, the doclet for `this.foo` had the wrong `longname` and `memberof`. Fixing that issue uncovered another issue: When we merged the constructor's doclet with the interface's doclet, we preferred the constructor's doclet. However, the constructor's doclet used the wrong `kind` in this case; we already had code to fix up the `longname` and `memberof` of the combined doclet, but not the `kind`. The fix was to prefer the interface's doclet for all properties.
16 lines
262 B
JavaScript
16 lines
262 B
JavaScript
/** @namespace */
|
|
const myCorp = {};
|
|
|
|
/**
|
|
* @interface
|
|
*/
|
|
myCorp.IWorker = class IWorker {
|
|
constructor(workerName) {
|
|
/** Name of the worker. */
|
|
this.workerName = workerName;
|
|
}
|
|
|
|
/** Interface for doing some work. */
|
|
work() {}
|
|
};
|