如何解决jsDoc:Class构造函数的src行号指向Class声明,而不是构造函数
但是该类的构造函数的jsDoc行号指向该类的顶部,而不是构造函数。即使使用@constructor
也无济于事。
有没有办法强迫jsDoc指向ctor,而不是类声明?
Ex:源文件
import util from './util.js'
/**
* Subclass of Array with convenience methods used by Netlogo.
* Typically the items in the array are Objects but can be any type.
*/
class AgentArray extends Array {
/**
* Convert an existing Array to an AgentArray "in place".
* Use array.slice() if a new array is wanted
*
* @static
* @param {Array} array Array to convert to AgentArray
* @return {AgentArray} array converted to AgentArray
*/
static fromArray(array) {
const aarray = Object.setPrototypeOf(array,AgentArray.prototype)
return aarray
}
/**
* Creates an instance of AgentArray. Simply pass-through to super()
* Now,but may add initialization code later.
* @param {*} args Zero or more items in Array
* @example
* let aa = new AgentArray({x:0,y:0},{x:0,y:1},{x:1,y:0})
* //=> [{ x: 0,y: 0 },{ x: 0,y: 1 },{ x: 1,y: 0 }]
*/
constructor(...args) {
super(...args)
// maybe do some initialization later
}
}
jsDoc html文件:
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。