我有一个类定义了一些实例属性Object.defineProperties,我很难让JSDoc 3认识到它们属于他们的类.
这是我正在使用的简化版本:
/** @exports mymodule */
function mymodule(exports) {
    /** @constructor
      * @param {String} foo A foo.
      * @param {String} bar A bar.
      * @classdesc Has a foo and a bar.
      */
    function Example(foo, bar) {
        Object.defineProperties(this, {
            /** A foo and a bar
              * @memberof Example
              */
            foobar: { enumerable: false, value: foo + bar, writable: false }
        });
    }
    exports.Example = Example;
}
当我运行JSDoc,我得到的输出mymodule,Example,foo,和bar,但不会foobar.如果我删除了@memberof标签foobar,它将被注册为全局标签.我试过@memberof mymmodule~Example,加入@lends到双方Object.defineProperties通话,并传递给它的对象,并将其转换为Object.defineProperty,但结果并没有改变.
我如何记录foobar属于Example?
在深入研究我能找到的每个例子之后,我终于收集了必要的咒语 - @memberof确实是诀窍,但JSDoc似乎要求在名称路径中使用的模块被明确标记为这样.以下工作完美:
/** A foo and a bar
  *
  * @type String
  * @instance
  * @memberof module:mymodule~Example
  */
| 归档时间: | 
 | 
| 查看次数: | 2134 次 | 
| 最近记录: |