【发布时间】:2017-04-24 00:19:35
【问题描述】:
我使用 @lends + @constructs + @augments 进行 MooTools 类定义(自定义命名空间变体),但是如果我在扩展类中不包含初始化,我会在 PhpStorm 中遇到一些扩展类的检查问题上面有一个@constructs。 jsDoc 中是否不可能在扩展类中省略初始化,或者 PhpStorm 检查无法正常工作?
new Class('Validator.Generic',
/**
* @lends Validator.Generic
*/
{
/**
* @constructs
*/
initialize:function(){}
}
new Class('Validator.Regex',
/**
* @augments Validator.Generic
* @lends Validator.Regex
*/
{
//PhpStorm inspection reports unrecognized symbol Regex unless
//I add a method with @constructs here, even though the class
//it augments has a constructor
});
我也尝试过变体。仅当我将初始化添加到扩展类(例如 Validator.Regex)以及 @constructs 标记到文档块时,它才有效。这当然不理想。
【问题讨论】:
-
add /** @class Validator.Regex */ above new Class('Validator.Regex') - 这应该会有所帮助
-
@lena 将此作为答案,以便我给予您信任。这似乎是我所追求的。