Нет «относительного» типа. Вы можете довольно тривиально изменить расширенный класс;
/** @extends {Base} */
class Sub extends Base{
/** @returns {Sub} */
static method(){
return super.method();
}
}
Или, возможно, использовать третий тип, @interface
, который определяет существование этого метода
/** @interface */
class I {
method() {}
}
/** @implements {I} */
class Base {
/** @returns {I} */
static method(){
return new this();
}
}
/**
* @extends {Base}
* @implements {I}
*/
class Sub {
/** @returns {I} */
static method(){
return new this();
}
}