microsoft / microsoft/TypeScript
Bad error when using `import()` type within JSDoc tag `@implements`
Offen
@sandersn arbeitet bereits daran.
Seit 17.6.2024.
Bug
Domain: JSDoc
- Vorherrschende Sprache
- Go
- Sterne
- 111k
- Forks
- 14.4k
- Ø Merge
- 1 T. 19 Std.
- Gemergte PRs (30 T.)
- 117
Beschreibung
🔎 Search Terms
import@implements2304
🕗 Version & Regression Information
- This is the behavior in every version I tried, and I reviewed the FAQ for entries about the JSDoc tag
@implements
⏯ Playground Link
💻 Code
/** @implements {import("a").B} */
class A {}
🙁 Actual behavior
Two TypeScript errors:
Cannot find name 'import'.(2304)'}' expected.(2304)
🙂 Expected behavior
TypeScript should allow using import() types within the type of the JSDoc tag @implements.
Additional information about the issue
A workaround is to use a JSDoc @typedef to import the type under an alias, and then use that alias within the JSDoc tag @implements type, e.g:
/** @typedef {import("a").B} B */
/** @implements {B} */
class A {}
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Bewertung
Dieses Issue wurde noch nicht bewertet.