I was trying to annotate a variable with jsdoc so it is read as a function. But using the bind call make the var be annotated as any.
var beaFunction = myFunction.bind(null,"some_string");
//tried those
/**
* @function
* @name getClientConsent
* @returns {string|null}
*/
var beaFunction = myFunction.bind(null,"some_string");
/**
* @function
* @returns {string|null}
*/
var beaFunction = myFunction.bind(null,"some_string");
/**
* @function
*/
var beaFunction = myFunction.bind(null,"some_string");
//thing is that having bind here seems to override whatever definition I place
//myFunction does not need annotation,
function myFunction(key) {
var d;
try {
d= localStorage.getItem(key);
} catch (error) {
console.error(error);
d = null;
}
return d;
}
myFunction returns {string|null} but bind gives any. I tried to annotate it as a function but ts-checker still says it is a any.
Any ideas what I can do here using only es5 features?