运行 babel 时,方法的 JSdoc 在转译代码中丢失

Mar*_*ari 9 javascript node.js jsdoc ecmascript-6 babeljs

我正在使图书馆变得更加用户友好,让消费者在使用图书馆时看到文档。

我有一个在构建时运行的脚本:

babel src --out-dir dist --quiet
Run Code Online (Sandbox Code Playgroud)

这是我的.babelrc

{
    "presets": [
       ["es2015", { "loose": true, "modules": "commonjs"  }]
    ]
}
Run Code Online (Sandbox Code Playgroud)

这个 ES6 类只有一个方法:

const { makeRequest } = require('../../lib/api');
const commonService = require('../commonService');

/**
 * @augments commonService
 */
class bingSpellCheck extends commonService {
    /**
     * Constructor.
     * 
     * @param {Object} obj
     * @param {string} obj.apiKey
     * @param {string} obj.endpoint
     */
    constructor(obj) {
        // code
    }

    /**
     * Perform contextual grammar and spell checking.
     * 
     * @param {Object} obj
     * @param {string} obj.parameters The parameters of the call
     * @param {string} obj.body The body
     */
    spellCheck({ parameters, body }) {
         //code
    }
}

module.exports = bingSpellCheck;
Run Code Online (Sandbox Code Playgroud)

转译为:

 /**
 * Constructor.
 * 
 * @param {Object} obj
 * @param {string} obj.apiKey
 * @param {string} obj.endpoint
 */
function bingSpellCheck(_ref) {
    var apiKey = _ref.apiKey,
        endpoint = _ref.endpoint;

    _classCallCheck(this, bingSpellCheck);

    var _this = _possibleConstructorReturn(this, _commonService.call(this, { apiKey: apiKey, endpoint: endpoint }));

    _this.endpoints = ["api.cognitive.microsoft.com"];
    return _this;
}

   /**
     * Perform contextual grammar and spell checking.
     * 
     * @param {Object} obj
     * @param {string} obj.parameters The parameters of the call
     * @param {string} obj.body The body
     */


    bingSpellCheck.prototype.spellCheck = function spellCheck(_ref2) {
        var parameters = _ref2.parameters,
            body = _ref2.body;
Run Code Online (Sandbox Code Playgroud)

这里的问题是文档丢失了。

在此输入图像描述

不过我可以在源代码中看到它吗?

在此输入图像描述

我如何告诉 babel 不要将参数转换obj_ref