Skip to content

In JS, typedefs should be automatically exported #23692

Closed
@sandersn

Description

@sandersn
// @Filename: module.js
/** @typedef {number} Num */
module.exports = { a: 1 }

// @Filename: use.js
/** @type {import("./module.js").Num} */
var n;

Expected:
Num is visible in use.js

Actual:
Num is not visible.

Note that the checker already has code to handle structures like this, so modules with modules.exports= should already almost work. Other kinds of modules may or may not.

The special-case merge code for module.exports= in the checker puts SymbolFlags.Value on all the symbols, which will be incorrect for this case, so that code will need to be updated.

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptDomain: JSDocRelates to JSDoc parsing and type generationFixedA PR has been merged for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions