microsoft / microsoft/TypeScript
Bad error when using `import()` type within JSDoc tag `@implements`
Đang mở
@sandersn đang làm issue này rồi.
Từ ngày 17/6/2024.
Bug
Domain: JSDoc
- Ngôn ngữ chính
- Go
- Star
- 111k
- Fork
- 14.4k
- Merge trung bình
- 1 ngày 19 giờ
- Pull request đã merge (30 ngày)
- 117
Mô tả
🔎 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 {}
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Đánh giá
Issue này chưa được đánh giá.