microsoft / microsoft/TypeScript

TS:1379 An import alias cannot reference a declaration that was exported using 'export type'

Đang mở
#54,855 12 bình luận 3 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Bug Domain: ES Modules Help Wanted
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ả

Bug Report

🔎 Search Terms

TS1379
An import alias cannot reference a declaration that was exported using 'export type'

🕗 Version & Regression Information

This has always been the behavior as far as I can tell (edit: tested on all versions listed in playground back to >3.7.5 (changed to export type {...} statement when needed))

⏯ Playground Link

Multi file: repro but I will show in playground.

Below are pictures that might be easier to parse

💻 Code

When annotated with type it errors
Screen Shot 2023-07-01 at 10 29 21 AM

Screen Shot 2023-07-01 at 10 30 29 AM

When not annotated with type it doesn't error:
Screen Shot 2023-07-01 at 10 31 27 AM

Screen Shot 2023-07-01 at 10 31 41 AM
🙁 Actual behavior

Exports of types annotated with type error while those not annotated as types do not error even though TS understand it is still a type.

🙂 Expected behavior

Honestly I don't know which of these behaviors is correct - this behavior could be completely intentional as well - intuitively I think these should match and I prefer the behavior with no errors but it is unclear to me if this is an emit issue? I'm sorry if this behavior is on purpose and I have wasted your time. Really appreciate the work!

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu với bản tái hiện TypeScript Playground nhiều tệp được liên kết và so sánh các trường hợp import-alias có chú thích và không có chú thích tạo ra TS1379. Trước tiên, xác định xem các chẩn đoán khác nhau là có chủ ý hay là lỗi trong emit/type-checking; công việc được xem là hoàn tất khi hành vi mong đợi đã được xác lập và được bao phủ bởi một regression test phù hợp.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
typescript
Lĩnh vực
compilers
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Ít trao đổi
Độ rõ ràng
Cần làm rõ
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.