You're going to think this looks hideous, but you can do this @param {module:someModule/SubModule~ExportedClass}
:
MyType.js
/**
* A dummy type module
* @module myModule/MyType
*/
/**
* Dummy type
*/
class MyType {
/**
* Creates a MyType
* @param {Number} foo Some var
* @param {Number} bar Some other var
*/
constructor(foo, bar) {
this.foo = foo;
this.bar = bar;
}
}
module.exports = MyType;
Some code that uses MyType
/**
* Test
* @inner
* @param {module:myModule/MyType~MyType} c The caption
*/
function test(c){
console.log(c);
}
This would give you something like this:

The key thing to note is that you need to be really explicit with JSDoc. The documentation provides a note detailing how to specify that certain objects or exports are part of a module using the module:MODULE_NAME
syntax here: CommonJS Modules: Module identifiers.
In most cases, your CommonJS or Node.js module should include a
standalone JSDoc comment that contains a @module
tag. The @module
tag's value
should be the module identifier that's passed to the require()
function. For example, if users load the module by calling
require('my/shirt')
, your JSDoc comment would contain the tag
@module my/shirt
.
If you use the @module
tag without a value, JSDoc will try to guess
the correct module identifier based on the filepath.
When you use a JSDoc
namepath to refer to a
module from another JSDoc comment, you must add the prefix module:
.
For example, if you want the documentation for the module my/pants
to link to the module my/shirt
, you could use the @see
tag to document my/pants
as
follows:
Here is another example using your exact files with the additional @module
declarations:
entities.js
/**
* Person Module
* @module Person
*/
/**
* Creates a person
* @class
*/
function Person(name) {
this.name = name;
this.age = 10;
}
module.exports = {
Person: Person
};
A.js
var Person = require("./entities").Person;
/**
* Module for putting people somewhere
* @module A
*/
/**
* Does something with persons
* @param {module:Person~Person[]} persons Some people
*/
function put(persons) {}
module.exports = {
put: put
};
Exact File Example Render
