运行babel时,JSdoc for方法在传输代码中丢失
我正在通过让消费者在使用文档时查看文档来使图书馆更加便于用户使用。
我有这个脚本在build上运行:
babel src --out-dir dist --quiet
这是我的.babelrc
:
{ "presets": [ ["es2015", { "loose": true, "modules": "commonjs" }] ] }
而这个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;
运输到这:
/** * 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;
这里的问题是文档丢失了。
但是,我可以在源代码中看到它吗?
如何告诉babel不要将参数obj
转换为_ref
?