microsoft / microsoft/TypeScript
Unable to retain JSDocs for higher order function
Chưa có ai nhận issue này.
- 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
When it comes to higher order function, the JSDocs for the resulting function are not persisted after transpile. declarationMap does not help in this regards either.
🔎 Search Terms
jsdocs, comments, higher order function, declarationmap
🕗 Version & Regression Information
4.9.4, but this should happen to all older versions.
"Bugs" that have existed in TS for a long time are very likely to be FAQs; refer to
https://github.com/Microsoft/TypeScript/wiki/FAQ#common-bugs-that-arent-bugs
Please keep and fill in the line that best applies:
-->
- This is the behavior in every version I tried, and I reviewed the FAQ for entries about _________
⏯ Playground Link
No playground link, as this requires transpilation.
💻 Code
/**
* this comment retains
**/
export function higher() {
/**
* this comment does not
**/
return function() {}
}
When using this code locally, the returning function does get the comment:
const foo = higher()
foo() // comment shows here
But once it is transpiled and published, the consumer of the package will not get the comment,
even if the package include the source, and using declarationMap
🙁 Actual behavior
No JSDocs comment.
🙂 Expected behavior
JSDocs comment should retain to aids consumer of the package.
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.
Hướng nghiên cứu
Bắt đầu bằng cách tái hiện vấn đề với ví dụ về hàm bậc cao và một lần chuyển mã tạo ra các khai báo, sau đó so sánh kết quả của mã nguồn cục bộ với những gì consumer của bản đã phát hành có thể thấy. Điều tra cách đầu ra đã chuyển mã và declarationMap xử lý JSDoc của hàm được trả về. Hoàn thành có nghĩa là chú thích được giữ lại và hiển thị với các consumer sau khi chuyển mã.
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
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 30/100