Let's say I have two functions, where one extends the other.
/**
* @abstract
* @param {Object} settings
* @param {Number} settings.x
* @param {Number} settings.y
*
*/
function Base(settings) {
this.x = settings.x;
this.y = settings.y;
}
/**
* @extends Base
*/
function Foo(settings) {
Base.call(this, settings);
}
These two functions are in two separate files. Is there any way I can inherit the parameter documentation from the Base
function in my Foo
function, or do I have to write the documentation twice?
I have tried making settings
a @typedef
like this:
/**
* @typedef {Object} BaseSettings
* @property {Number} x
* @property {Number} y
*
*/
/**
* @extends Base
* @param {BaseSettings} settings
*/
function Foo(settings) {
Base.call(this, settings);
}
But this just links to a global Type Definitions, and I want the parameter documented on the same page as the function. But is this even possible, without writing the documentation twice?
I don't think this can be done. You can document it via @typedef
as in your question but it will just link the type to its definition. I'm not aware of a way of inlining a defined type.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With