-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Description
In @type
(and other type defining tags) it's possible to reference external JS objects by using import("./relative/path").objectName
.
This should also be possible in @link
both to avoid importing unexecuted code, and to avoid errors in common tools & frameworks regarding the unused imports.
Input code
/**
* @see {@link import("./file.js").objectName} this thing may be of interest for reasons
*/
/* ... */
Expected behavior
The @link
inline tag should provide a reference to the exported objectName
in ./file.js
Current behavior
The @link
tag does not provide any reference, and (at least when using VSCode to render) shows up as the plaintext import("./file.js").objectName
instead of a clickable link
Your environment
Software | Version |
---|---|
JSDoc | (supplied with VSCode 1.67) |
Node.js | 18.2.0 |
npm | 8.9.0 |
Operating system | Linux (Pop OS 21.10) |
Why this functionality matters
I use TypeScript for pretty much everything I write at this point. I want my JS output to be the absolute minimum it needs to be, because my DTS will do all the in-editor documentation; I set removeComments = true
for JS and = false
for DTS.
However, because I have to import the objects I want to reference in @link
, and because TypeScript is "helpful" and treeshakes unused imports, they've been removed by the time my DTS files are generated with JSDoc preserved. However, this now means that my @link
tags no longer work.
There is a TypeScript issue to add support for @link
targets being treated as "used" values, however it could be useful in many cases for JSDoc to support the import(file).member
syntax in @link
as well as TypeScript fixing it's own behavior.
If this is supposed to be possible, and is just VSCode not rendering JSDoc correctly, let me know and I'll bring up this issue over there instead