I come this time with a very simple question. Is there a way, on JSDOC, to describe what this
represents in a class?
/**
* This is a very simplified version of what is going on
*
* I want to add something here to indicate that, inside this function, `this` === CalledClass,
* so autocomplete for parameters/etc work
*/
const unboundedFunction = function () {
console.log(this);
this.parameter = 50;
}
class CalledClass {
parameter = 'test';
callOutsideFunction() {
unboundedFunction.bind(this)();
}
}
const obj = new CalledClass();
obj.callOutsideFunction();
/** @this CalledClass */
const unboundedFunction = function () {
console.log(this);
this.parameter = 50;
}
class CalledClass {
parameter = 'test';
callOutsideFunction() {
unboundedFunction.bind(this)();
}
}
const obj = new CalledClass();
obj.callOutsideFunction();