Webstorm 可以在JSDoc中指定函数重写吗?

Webstorm 可以在JSDoc中指定函数重写吗?,webstorm,jsdoc,Webstorm,Jsdoc,我希望记录的一个例子如下: /** * @return {boolean} */ Contains(rectangle_or_x, y, tolerance) { if (rectangle_or_x instanceof Rectangle) { return ((rectangle_or_x.X >= this._x) && (rectangle_or_x.Y >= this._y) && (rectangle_or_x.Right &

我希望记录的一个例子如下:

/**
 * @return {boolean}
 */
Contains(rectangle_or_x, y, tolerance) {
    if (rectangle_or_x instanceof Rectangle) { return ((rectangle_or_x.X >= this._x) && (rectangle_or_x.Y >= this._y) && (rectangle_or_x.Right <= this._right) && (rectangle_or_x.Bottom <= this._bottom)); }
    if ((tolerance === undefined) || (tolerance === null) || (!Rectangle._isNumeric(tolerance))) {
        if ((rectangle_or_x < this._x) || (y < this._y) || (rectangle_or_x > this._right) || (y > this._bottom)) { return (false); }
    } else if (((rectangle_or_x + tolerance) < this._x) || ((y + tolerance) < this._y) || ((rectangle_or_x - tolerance) > this._right) || ((y - tolerance) > this._bottom)) { return (false); }
    return (true);
}

考虑到不同的类型(我知道JavaScript是非类型的,但就示例而言,涉及到确定的类型),是否可以使用JSDoc创建单独的
@param
值集(主要用于WebStorm中的intellisense,但理论上也用于后续文档)

无法指定JSdoc的独占集

您可以尝试以下方法:

/**
 * @param {Rectangle|Number} rectangle_or_x
 * @param {Number=} y
 * @param {Number=} tolerance
 * @return {boolean}
 */
Contains(rectangle_or_x, y, tolerance) {}
/**
 * @param {Rectangle|Number} rectangle_or_x
 * @param {Number=} y
 * @param {Number=} tolerance
 * @return {boolean}
 */
Contains(rectangle_or_x, y, tolerance) {}