Closed
Description
Search Terms:
JSDoc default named exports @typedef
Code
Given the following files:
/// file1.js
function foo() { return true; }
export { foo };
/// file2.js
/**
* @typedef { ReturnType<import('./file1').foo> } Foo
*/
TypeScript / VSCode will correctly identify the type.
However, if it's a default export like:
/// file1.js
function foo() { return true; }
export default foo;
... then there seems to be no way for TS to recognize the type via @typedef
. Neither of the following will work:
/// file2.js
/**
* @typedef { ReturnType<import('./file1')> } Foo
*/
/**
* @typedef { ReturnType<import('./file1').default> } Foo
*/
Related Issues:
Possibly Related? #33136
Metadata
Metadata
Assignees
Labels
No labels