The Google Closure compiler has an @typedef tag, but can I use them in my code? (I know this will work, but frowned?)
So here is my type
/ **
* The plan object typedef
* @typedef {Object}
* /
Types.Plan = {
"style": "bordersmall",
"width": "50%",
"height": "40%",
"x": "20%",
"y": "10%",
"clickable": true,
"moveable": true
};
And then I can use this type in my JSDoc annotations.
This allows my IDE to give me autocomplete on the passed parameter
Thus, the declared object is not used anywhere in the code.
/ **
* The Instructions class
* @param {Types.Plan} plan Plan for position and dimension
* @param {Manager} manager The manager
* @param {Instructions} parent This widget parent instructions
* @return {Instructions} Returns the new instructions object
* /
Instructions = function (plan, manager, parent) {
plan.
}
So is that normal? Or is there a better solution?
source share