Hello,
I’m wondering how I could document an object/array whose properties holding common properties, which structure could be the following
var myVar = {};
myVar.aformname1= {};
myVar.aformname1.property1IsString= ‘A’;
myVar.aformname1.property2IsBoolean = true;
myVar.aformname1.property3IsObject= {};
myVar.aformname1.property4IsArrayOfString= ;
myVar.aformname1.property4IsArrayOfNumber= ;
myVar.aformname2= {};
myVar.aformname2.property1IsString= ‘A’;
myVar.aformname2.property2IsBoolean = true;
myVar.aformname2.property3IsObject= {};
myVar.aformname2.property4IsArrayOfString= ;
myVar.aformname2.property4IsArrayOfNumber= ;
So the ‘aformname2’ should be dynamic, and the rest are common properties associated
At the moment, my JSDoc works without the dynamic part of it, with a lot of expected reptitions that I’m sure I cas avoid, but I can’t figure out how
@type{{
aformname1:{
property1IsString:String,
property2IsBoolean:Boolean,
property3IsObject:{};
property4IsArrayOfString:Array,
property4IsArrayOfNumber:Array
},
aformname2:{
property1IsString:String,
property2IsBoolean:Boolean,
property3IsObject:{};
property4IsArrayOfString:Array,
property4IsArrayOfNumber:Array
}
}}
Is there any way for this ?
Thanks
Ugo
Ok, never mind I solved it :
Here’s one variation of it, just in case.
We use it to store foundsetFilterParams per form in a global variable in our solution. The basic remains the same :
In this case, we needed an object of type :
var storedFilterParams={};
storedFilterParams.aFormname.theFiltername= {};
storedFilterParams.aFormname.theFiltername.theTable= ‘MyTable’;
storedFilterParams.aFormname.theFiltername.theDataprovider= ‘MyDataProvider’;
etc.
@type {Array<Array<{theTable:String,theDataprovider:String,theOperator:String,theFilterValue:*}>>}
I’m not sure if that answers your question, but I’ll do as follows.
/**@type{{frmProperties:Array<{frmName:String,properties:{property1IsString:String,property2IsBoolean:Boolean,
property3IsObject:{},
property4IsArrayOfString:Array<String>,
property4IsArrayOfNumber:Array<Number>}}>
}
}*/
var myVar = {};
/**@type {{frmName:String,properties:{property1IsString:String,property2IsBoolean:Boolean,
property3IsObject:{},
property4IsArrayOfString:Array<String>,
property4IsArrayOfNumber:Array<Number>}}}*/
var frm = new Object();
myVar.frmProperties = new Array();
frm.frmName = "aformname1";
frm.properties.property1IsString = 'A';
etc
myVar.frmProperties.push(frm);
frm = new Object();
frm.frmName = "aformname2";
frm.properties.property1IsString = 'A';
myVar.frmProperties.push(frm);