ES6语法允许重命名解构变量和参数。
变量:
const {requestID: _requestID, notifyChanges: _notifyChanges} = someObject;
console.log(_requestID, _notifyChanges);
参数:
/**
* Creates a cloud ready request.
* @param {String} requestID Request ID used for for tracing and logs
* @param {Boolean} [notifyChanges] Send an event to the message queue.
*/
function createRequest({
requestID: _requestID,
notifyChanges: _notifyChanges = false,
}) {
console.log(_requestID, _notifyChanges);
});
尽管上面的JavaScript代码是有效的,但JSDoc会显示错误,指出:
JSDoc中描述的参数'requestID'在函数签名中没有出现
我应该如何在JSDoc中正确注释重命名后的函数参数?