jsdoc/test/fixtures/interface-implements2.js
Jeff Williams 95e3192525 fix: correctly track interface members
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.
2020-09-19 19:24:14 -07:00

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 {}