microsoft / microsoft/TypeScript

JSDoc `@import` no longer works correctly with default exports

Offen
#60,317 4 Kommentare 2 Reaktionen 1 zugewiesene Person Auf GitHub ansehen

@sandersn arbeitet bereits daran.

Seit 08.11.2024.

Needs Investigation Needs More Info
Vorherrschende Sprache
Go
Sterne
111k
Forks
14.4k
Ø Merge
1 T. 19 Std.
Gemergte PRs (30 T.)
117

Beschreibung

🔎 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

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.