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.
24 lines
296 B
JavaScript
24 lines
296 B
JavaScript
/**
|
|
* @interface
|
|
*/
|
|
class IWorker {
|
|
/** Interface for doing some work. */
|
|
work() {}
|
|
}
|
|
|
|
/**
|
|
* @implements {IWorker}
|
|
*/
|
|
class MyWorker {
|
|
/** Do some work. */
|
|
work() {}
|
|
|
|
/** Process a thing. */
|
|
process() {}
|
|
}
|
|
|
|
/**
|
|
* @implements {IWorker}
|
|
*/
|
|
class MyIncompleteWorker {}
|