I'm working on Gscript.
function globales() {
var data = {
dir: DriveApp.getFolderById('id'),
sinky: "test",
numberino : 42
};
return data;
}
function test()
{
var rep = globales().dir.getName() // get the name of the directory.
return rep
}
I would like to use jsdoc so that when I write this code, the return type of the variable "dir" can display 'DriveApp.Folder'. Basically, specify for all keys within the 'data' structure in 'global' function : the type of the data (e.g., a string, a number, a DriveApp.Folder)
Something like @param {string} to precise function parameter type.
Seems like you're looking for the @property tag. Based on your code you can try something like the following:
/**
*Returns an Object with some global variables
*
*@function globales
*@property {DriveApp.Folder} dir - Folder ID
*@property {String} sinky - Some string
*@property {int} numberino - Some number
*@returns {Object} - Array with different data
*
*/
function globales() {
var data = {
dir: DriveApp.getFolderById('id'),
sinky: "test",
numberino : 42
};
return data;
}
function test()
{
var rep = globales().dir.getName() // get the name of the directory.
return rep
}
And the output in the documentation would be:
May vary depending on how you want to format it but this should work. If your function has input parameters you can use the @param tag and it will add a separate table.