I'm looking to fill in the XXXXXXXXXXXXXX line with something that allows JSDoc to know that the @throws should propagate upwards. Currently, JSDoc doesn't seem to realize that doSomething() can throw an error because getParamOrCurrent() can throw an error, and I'm not sure how to tell JSDoc that it can propagate upwards. Any ideas?
This is an example code that demonstrates the concept
let current;
/*
* Do a thing
* @param {?obj} [input] - The thing to use
* XXXXXXXXXXXXXXXXXXXX
*/
function doSomething(input=null)
{
const thingToUse = getParamOrCurrent(input);
//Do things with it
}
/*
* Get the param or the current thing
* @param {?obj} input - The param
* @returns {obj} The thing to use
* @throws Error if no input or current
*/
function getParamOrCurrent(input)
{
if( input )
{
return input;
}
if( current )
{
return current;
}
throw "No input or current";
}