I have a class that extends a class from some external code. In my "constructor", I set a field that the parent uses to make an API call and upon completion, the result gets stored in the data
property (accessible from my class instance via this.data
).
How can I tell VSCode via JSDoc comments what the structure of this.data
is? I actually create the data structure that returns from the API call so it is known to me. I have @typedef
s in my code but I can't seem to properly tell the class what this.data
looks like.
The best I have been able to do that works is like the below:
class a extends b {
render() {
const stuff = /** @type {Stuff} */ (this.data).stuff[1].thing;
}
}
The problem with this approach is that it is only applicable for that particular usage of this.data
.