JSDoc Toolkit-如何在同一行上指定@param和@property

|| 有没有一种方法可以避免必须为@property和@param输入两个单独的行,如在示例中,在构造函数上,参数和属性的名称相同。
/**
 * Class for representing a point in 2D space.
 * @property {number} x The x coordinate of this point.
 * @property {number} y The y coordinate of this point.
 * @constructor
 * @param {number} x The x coordinate of this point.
 * @param {number} y The y coordinate of this point.
 * @return {Point} A new Point
 */
Point = function (x, y)
{
    this.x = x;
    this.y = y;
}
    
已邀请:
        你不。这是不可能的,因为对象的函数和属性的参数-这些是不同的变量,因此不能同时是函数参数和对象属性。 此外,此类文档只会使开发人员感到困惑,而无助于理解API。 我建议您不要在本文档中使用@properties,而应使用@type:
/**
 * Class for representing a point in 2D space.
 * @constructor
 * @param {number} x The x coordinate of this point.
 * @param {number} y The y coordinate of this point.
 * @return {Point} A new Point
 */
Point = function (x, y)
{
    /**
     * The x coordinate.
     * @type number
     */
    this.x = x;

    /**
     * The y coordinate.
     * @type number
     */
    this.y = y;
}
但是实际上,如此详细的文档是没有用的。任何小学生都清楚我们在代码2ѭ中所说的话。     

要回复问题请先登录注册