"- The property <...> is undefined in javascript" warning

I encountered this strange warning in JavaScript while coding a prototype of an object. The warning message is in the attachment. Please note that removing top reference to “this” scope variable removes the warning. My workaround was to set “this” scope variables (y and z in the example) to local variables in “var” declaration at the top of the function.

yes i think the code parser doesn’t fully work with those kind of object constructs and then the usage of the “this” in a function of such an object.

Have a look at the @this JSDoc annotation with which you can specify the type of ‘this’

Not ideal to have to type it using JSDoc, but at least it works.

Paul

Already any progess on @this matter?

I want to properly JSDoc type several constructors like the following:
/**

  • @type{{sKey:String, aForm:Array, sMethod:String, aArguments:Array}} oSHORTCUT
  • @properties={typeid:35,uuid:“ADA39EDF-12AD-4DD0-8EB2-1B5B199E44CF”,variableType:-4}
    */
    var oSHORTCUT = function(){
    this.sKey = ‘’;
    this.aForm = ;
    this.sMethod = ‘’;
    this.aArguments = ;
    };

The @type declaration isn’t working of course. I have been playing around with @this and @constructor. Even tried @class, @property although Servoy doesn’t seem to know these types.
Can anybody tell me how to do this? And can somebody please point me to JSdoc documentation which is understandable, even for me?

Don’t see how your question is related to @this, but anyway: what is not woring in this code for you?

/**
* @constructor 
* @properties={typeid:35,uuid:"ADA39EDF-12AD-4DD0-8EB2-1B5B199E44CF",variableType:-4}
*/
var oSHORTCUT = function(){
	this.sKey = '';
	this.aForm = [];
	this.sMethod = '';
	this.aArguments = [];
};

function test() {
	var x = new oSHORTCUT()
	x.
}

The object properties don’t get a type declaration. I thought with @this I could give every property a type declaration. So when you create a new shortcut object out of the constructor you want to show the user the inteded types as is the keys with other properties an methods, see picture.

[attachment=0]Shortcut_instantiation.png[/attachment]

I think Servoy knows the types just fine, it is just that it is not displaying them in the code completion popup.

Probably if you provide JSDoc comments with an @type annotation for each property the types will start to show up, but I think Servoy should show those automatically. Best to file a case for that.