最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - how to document enum values in JS Doc - Stack Overflow

programmeradmin1浏览0评论

I am using JS Doc to generate docs for JS. I have an enum with few values. I want to generate docs for each property. I tried the following:

/**
 * Enum for display state.
 * @readonly
 * @enum {string}
 */
var DisplayState = {
    /** @member {string} */
    foreground: 'foreground',
    /** @member {string} */
    background: 'background',
    /** @member {string} */
    projected: 'projected'
};

But after HTML page is generated, I only see doc for enum type not individual properties.

I've tried the following /** some ment */ /** @member {string} */ And /** @property {string} */ but nothing seems to work

I am using JS Doc to generate docs for JS. I have an enum with few values. I want to generate docs for each property. I tried the following:

/**
 * Enum for display state.
 * @readonly
 * @enum {string}
 */
var DisplayState = {
    /** @member {string} */
    foreground: 'foreground',
    /** @member {string} */
    background: 'background',
    /** @member {string} */
    projected: 'projected'
};

But after HTML page is generated, I only see doc for enum type not individual properties.

I've tried the following /** some ment */ /** @member {string} */ And /** @property {string} */ but nothing seems to work

Share Improve this question edited Oct 10, 2016 at 19:36 Sai asked Oct 10, 2016 at 19:10 SaiSai 2,1093 gold badges20 silver badges31 bronze badges 6
  • have you tried removing @member? – Daniel A. White Commented Oct 10, 2016 at 19:14
  • usejsdoc/tags-enum.html – Daniel A. White Commented Oct 10, 2016 at 19:14
  • Yes, I've tried 1. removing member 2. Adding property 3. removing member and property – Sai Commented Oct 10, 2016 at 19:17
  • what version of jsdoc? – Daniel A. White Commented Oct 10, 2016 at 19:18
  • JS Doc version 2.4.0 – Sai Commented Oct 10, 2016 at 19:19
 |  Show 1 more ment

1 Answer 1

Reset to default 5

I upgraded to Version 3 of JS Doc (https://github./jsdoc3/jsdoc) and this issue was fixed.

See example below:

/**
 * Enum for display state.
 * @readonly
 * @enum {string}
 */
var DisplayState = {
    /** @member {string} */
    /** The app is running in the foreground and can receive user input. */
    foreground: 'foreground',

    /** @member {string} */
    /** The app is in the background and can't receive user input. */
    background: 'background',

    /** @member {string} */
    /** The app is running in Phone Projection mode (Android Auto or Apple Car Play). */
    projected: 'projected'
};
发布评论

评论列表(0)

  1. 暂无评论