'JSDoc class fields type override
Using JavaScript latest class syntax, I have a class A, and has a public field which is an Area object:
class Area {
/** @type {number} */
left;
/** @type {number} */
top;
/** @type {number} */
width;
/** @type {number} */
height;
}
class A {
/** @type {Area} */
area;
}
Now, I have a class Square extending class Area, and another class B extending class A. How can I state in JSDoc to re-define the type of B.area as a Square object, without re-declaring it?
class Square extends Area {
}
class B extends A {
/** @type {Square} */
area; // <-- I want to remove this line of declaration, but to keep the new typing notation.
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
