Hi Servoy,
What is the correct way to document in Servoy the properties of custom JavaScript "types" using JSDoc?
For example, in a form named "customTypes" we have something similar to:
- Code: Select all
/**
* Custom type for form parameters
*
* @constructor
* @param {String} _name
* @param {Object} [_value]
*/
function FormParam(_name, _value)
{
/** @type {String} */
this.name = _name;
/** @type {Object} */
this.value = _value;
}
/**
* Custom complex type which uses another custom type as a property
*
* @constructor
* @param {String} _formName
*/
function ComplexType(_formName)
{
/** @type {String} */
this.formName = _formName;
/** @type {forms.customTypes.FormParam} */
this.formParam = new forms.customTypes.FormParam('SPECIAL_PARAM_NAME');
}
Now when we use the custom
ComplexType, the code completion works correctly but only for its own properties. If we try to access some of the properties of its formParam property, we get a warning that the property is not defined:
- Code: Select all
function doSomething()
{
//create a custom type - note that adding the @type tag to explicitly specify the custom type does not help in resolving the described issue
/** @type {forms.customTypes.ComplexType} */
var _complexType = new forms.customTypes.ComplexType('someFormName');
//here the "value" property of the formParam is "unknown" - the warning which we get is: "The property value is undefined in _complextType.formParam"
_complextType.formParam.value = {foo: 123};
}
Is the above usage supported by Servoy? Are we missing something in the properties documentation for the custom types? When we inspect the "formParam" property of the _complexType variable in the example above, the tooltip in Servoy is something like:
----------------------------------------------
formParamType{forms.customTypes.FormParam} *
----------------------------------------------
Note the trailing
* at the end of the tooltip text - is this an indication of incorrect parsing of the
@type JSDoc tag when the custom property is defined or are we using it incorrectly?
Any help on this is greatly appreciated!