我想在Eclipse/JSDT中指定实例变量的类型,如下例所示:
/**
* @constructor
*/
function A() {
/** @type Node */
this.x = document.createElement("p");
}但是,集成开发环境无法识别x的类型。另一方面,像这样的声明
/** @type Node */
var x;确实有效,即在这种情况下,已知x具有Node的类型。
如果我添加
A.prototype.x = new Node();在第一个示例中,x将被称为Node类型的变量。但是,此代码不会运行。
发布于 2012-09-19 16:45:17
/** @type Node*/
A.prototype.x = undefined;https://stackoverflow.com/questions/9411879
复制相似问题