microsoft / microsoft/TypeScript

typedef imports should use default exports

Đang mở
#36,587 4 bình luận 0 reaction 0 người được giao Xem trên GitHub

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

Awaiting More Feedback In Discussion Suggestion
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

checkJs typedef import

Suggestion

When the module ./core.controller has a default export defined, I would like to be able to do:

/**
 * @typedef { import("./core.controller") } Chart
 */

Instead of:

/**
 * @typedef { import("./core.controller").Chart } Chart
 */

Use Cases

My file had defined export default Chart;.

TypeScript made me add a duplicate export, which I don't want to have to add

export {
	Chart
};

This resulted in lots of extra code

It also took me an extremely long amount of time to figure out I needed to do this because the documentation did not mention this as a limitation.

Examples

Already shared in the above sections.

Checklist

My suggestion meets these guidelines:

  • This wouldn't be a breaking change in existing TypeScript/JavaScript code
  • This wouldn't change the runtime behavior of existing JavaScript code
  • This could be implemented without emitting different JS based on the types of the expressions
  • This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, etc.)
  • This feature would agree with the rest of TypeScript's Design Goals.

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 phần import types trong sổ tay TypeScript và các dạng import typedef JSDoc hiện có được nêu trong issue. Theo dõi cách một module được export mặc định được biểu diễn và kiểm thử, sau đó xác nhận rằng dạng import ngắn hơn được chấp nhận mà không yêu cầu một named export trùng lặp và tài liệu mô tả hành vi này.

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

Đánh giá

Công nghệ
javascript, typescript
Lĩnh vực
compilers
Loại issue
Tính năng
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
38/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.