Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [wtp-dev] Type inferral on JSDT

The type in the JSdoc is used for inferencing, but you do not have it specified correctly, it should be enclosed in "{}" before the param name, like
  * @param {Node} _this

Adding the directive @memberOf  like
  * @memberOf DOM
should make the static method work correctly, but there appears to be a bug preventing it from working correctly. I will fix it. As a workaround, you can add this line:
  var xx = new DOM();

Phil Berkland
IBM Software Group Emerging Technologies

"Andres C. Rodriguez" <acr@xxxxxxxxxx>
Sent by: wtp-dev-bounces@xxxxxxxxxxx

02/14/2008 01:19 PM

Please respond to
"General discussion of project-wide or architectural issues."        <wtp-dev@xxxxxxxxxxx>

[wtp-dev] Type inferral on JSDT


I am trying to make JSDT work for my JS libraries. I have a couple of

1. Is the type in the JsDoc used for type inference?  I have the code
below, but I am getting a warning saying: 'nextSibling cannot be
resolved or is not a field' over 'nextSibling'.  If it is not used, what
other way do I have to tell JSDT the type of a certain object.

2. Static functions such as the one below (not attached to prototype)
are being shown in the outline, but then flagged as errors: 'The
function insertAfter(any, any, any) is undefined for the type Function'.
 I should note that this happens when I try to use the static function
inside the same JS file, when I use it outside, things seem to work.

Thanks for your help and keep up the good work.



 * Inserts 'newElem' as a child of '_this' after element 'refElem'
 * @param _this   Node
 * @param newElem Node
 * @param refElem Node
DOM.insertAfter = function(_this, newElem, refElem) {
    var ns = refElem.nextSibling;
    if (ns == null) _this.appendChild(newElem);
    else _this.insertBefore(newElem, ns));
wtp-dev mailing list

Back to the top