【发布时间】:2020-04-26 12:13:40
【问题描述】:
假设我有这个定义类的 javascript 代码。它的一个静态方法返回一个用于实例化子级的类。
class ParentClass {
/**
* Creates an instance of parent class
*
* @param {string} type - the type of the instance.
*/
constructor(type) {
this.type = type;
}
/**
* Creates a child class.
*
* @param {string} type - the type.
*
* @returns {class<ParentClass> ?? ----- WHAT GOES HERE?? -----} the resulting class.
*/
static createChildClass(type) {
return class extends ParentClass {
constructor() {
super(type);
}
};
}
}
我正在使用 eslint 插件eslint-plugin-jsdoc 来检查代码中的 JSDoc cmets。
我的问题是:记录类型(在@param 或@returns 中)的正确方法是什么,该类型是从另一个类扩展的类?换句话说,我如何记录上面代码中标记的@returns?
【问题讨论】:
标签: javascript eslint jsdoc