I need to use JSDoc to make sock
, data
variables known
var exec = {
/**
* @param {Number} sock
* @param {String} data
*/
1: (sock, data) => {
console.log("GG");
},
2: (sock, data) => {
},
3: (sock, data) => {
}
};
let's say sock is Number
, and data is String
.
/**
* @param {Number} sock
* @param {String} data
*/
I need to set the JSDoc one time only, for the whole object.
/**
* @type {Object.<number, function(Object, Object):void>}
*/
var exec = {
1: (sock, data) => {
console.log("GG");
},
2: (sock, data) => {
},
3: (sock, data) => {
}
};
This defines an object with numbers as keys and functions as values which takes two params of type Object.
The Syntax compiles from
Object.<[keyType, valueType]>
and
function(param1Type, param2Type, ...):returnType