JSDoc @param - 从另一个模块引用 class

JSDoc @param - reference class from another module

我有 2 个节点模块。在模块 A 中,我有以下定义:

/**
 * HTTP Client
 * @module src/http/client
 */
/**
 * A HTTP Client
 * @alias src/http/client
 */
class HTTPClient {
   [... class def with documented methods etc]
}
module.exports = HTTPClient

现在在模块 B 中,我想说第一个构造函数参数应该是 HTTPClient 类型。所以我尝试了以下

class PackageFactory {
    /**
     * @param {module:src/http/client} httpClient - the HTTPClient instance
     */
    constructor(httpClient) {
       this._httpClient = httpClient
    }
}

我也尝试了一些变体,但都没有用。在模块 B 中,httpClient 始终是 "any" 类型。我必须更改什么才能在模块 B 中看到 HTTPClient 的 class 成员?

解决方案比我想象的要简单。不需要包含模块路径(又名 longname)或任何东西。

const HTTPClient = require('../http/client')
class PackageFactory {
    /**
     * @param {HTTPClient} httpClient - the HTTPClient instance that shall be used to make requests
     */
    constructor(httpClient) {
       this._httpClient = httpClient
    }
}