gpt4 book ai didi

jsdoc - 如何使用 JSDoc 记录 ES6 类属性

转载 作者:行者123 更新时间:2023-12-04 12:03:11 33 4
gpt4 key购买 nike

我正在使用 documentation package ,但无法弄清楚如何将它记录为类属性(不是通过 getter 和 setter 定义的)。

下面只为 SomeClass 生成类文档,但省略了 someProperty 文档。

/**
* SomeClass is an example class for my question.
* @class
* @constructor
* @public
*/
class SomeClass {
constructor () {
this.someProperty = true // how do I document this?
}

/**
* someProperty is an example property that is set to `true`
* @property {boolean} someProperty
* @public
*/
}

旁白: @constructor在 jsdoc 类上是 documentation thing .

最佳答案

将 JSDoc 移动到第一次定义它的构造函数中。

/**
* SomeClass is an example class for my question.
* @class
* @constructor
* @public
*/
class SomeClass {
constructor () {
/**
* someProperty is an example property that is set to `true`
* @type {boolean}
* @public
*/
this.someProperty = true
}
}

我不确定是否有办法使用 documentation package 来完成它使用不涉及将 JSDoc 内联到构造函数中的方法。

关于jsdoc - 如何使用 JSDoc 记录 ES6 类属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51467835/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com