microsoft / microsoft/TypeScript
Bad error when using `import()` type within JSDoc tag `@implements`
Ouverte
@sandersn y travaille déjà.
Depuis le 17/6/2024.
Bug
Domain: JSDoc
- Langage dominant
- Go
- Étoiles
- 111k
- Forks
- 14.4k
- Merge moyen
- 1 j 19 h
- PR mergées (30 j)
- 117
Description
🔎 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 {}
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Évaluation
Cette issue n'a pas encore été évaluée.