I would like to specify in Eclipse/JSDT the type of an instance variable as in the following example:
/**
* @constructor
*/
function A() {
/** @type Node */
this.x = document.createElement("p");
}
The IDE, however, does not recognise the type of x
. On the other hand, a declaration like
/** @type Node */
var x;
does work, i.e. in this case, x
is known to have the type of a Node
.
If I add
A.prototype.x = new Node();
to the first example, x
will be known as a variable of type Node
. However, this code does not run.