microsoft / microsoft/TypeScript
JSDoc `@import` no longer works correctly with default exports
Open
@sandersn is already working on this.
Since Nov 8, 2024.
Needs Investigation
Needs More Info
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.4k
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 117
Description
🔎 Search Terms
jsdoc import @import
🕗 Version & Regression Information
This changed between versions 5.5.4 and 5.6.3.
⏯ Playground Link
No response
💻 Code
/** @import Foo from "my-app/foo" */
/** @return {Foo} */
function getFoo() {
return myFoo;
}
tsconfig.json excerpt:
{
"compilerOptions": {
"baseUrl": ".",
"paths": {
"my-app/*": ["src/*"]
}
}
}
🙁 Actual behavior
In TypeScript 5.5 the above worked correctly with getFoo returning Foo. As of TypeScript 5.6 this now returns an any. This workaround resolves the problem but feels like it is not what is intended.
/** @import { default as Foo } from "my-app/foo" */
/** @return {Foo} */
function getFoo() {
return myFoo;
}
🙂 Expected behavior
I expected default exports to work with @import in JSDoc.
Additional information about the issue
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.