Skip to main content

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


Hello,

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

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.


ACR


------

/**
 * 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));
}


Back to the top