Suggestion
🔍 Search Terms
jsdoc typedef export #43207#23692
✅ Viability Checklist
My suggestion meets these guidelines:
⭐ Suggestion
Currently when using /** @typedef {Number} Num */ the type Num is automatically exported when the comment is in the root scope. I'd like to prevent this from happening.
📃 Motivating Example 💻 Use Cases
My problem:
FileA.js declares /** @typedef {Number} Num */
FileB.js uses this type a bunch of times, so instead of using /** @type {import("./FileA.js").Num} */ everywhere, it declares it once at the top of the file: /** @typedef {import("./FileA.js").Num} Num */ and then uses Num everywhere in the file.
The problem is that doing it this way in all files creates a lot of exports of the same type and it's not always clear which one is the original export. This creates a rather big list with Intellisense:

A woraround is to wrap the type in parentheses, this causes the typedef to be limited to that scope, but this is not always feasible. I.e:
{/** @typedef {import("./FileA.js").Num} Num *//** * @param {Num} */exportdefaultfunctionfoo(x){// <-- error, export needs to be top level}}
Suggestion
🔍 Search Terms
jsdoc typedef export #43207#23692
✅ Viability Checklist
My suggestion meets these guidelines:
⭐ Suggestion
Currently when using
/** @typedef {Number} Num */the typeNumis automatically exported when the comment is in the root scope. I'd like to prevent this from happening.📃 Motivating Example 💻 Use Cases
My problem:
FileA.jsdeclares/** @typedef {Number} Num */FileB.jsuses this type a bunch of times, so instead of using/** @type {import("./FileA.js").Num} */everywhere, it declares it once at the top of the file:/** @typedef {import("./FileA.js").Num} Num */and then usesNumeverywhere in the file.The problem is that doing it this way in all files creates a lot of exports of the same type and it's not always clear which one is the original export. This creates a rather big list with Intellisense:

A woraround is to wrap the type in parentheses, this causes the typedef to be limited to that scope, but this is not always feasible. I.e: