microsoft / microsoft/TypeScript

JSDoc `@private` on constructor without parameters is omitted in declaration files

Đang mở
#58,653 0 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: Declaration Emit
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

jsdoc private constructor

🕗 Version & Regression Information
  • This is the behavior in every version I tried back through TS 3.8 where JSDoc support was added, and I reviewed the FAQ for entries about JSDoc
⏯ Playground Link

https://www.typescriptlang.org/play/?target=99&module=1&ts=5.5.0-beta&ssl=8&ssc=10&pln=1&pc=1&filetype=js#code/MYGwhgzhAEBiD29oG8BQ0PQPQCofs2h2gAEAHAJwEsA3MAFwFMDMcsXph4A7CeigK7B68CgAoAlCgC+qWam6MA7nESSgA

💻 Code
// foo.js
class Foo {
    /**
     * @private
     */
    constructor() {}
}

new Foo()
// Constructor of class 'Foo' is private and only accessible within the class declaration.(2673)
🙁 Actual behavior

Emits the declaration file:

declare class Foo {
}
🙂 Expected behavior

Should emit the declaration file:

declare class Foo {
    /**
     * @private
     */
    private constructor();
}
Additional information about the issue

I ran into this as it was requested that TypeDoc add a new JSDoc tag to work around this issue. This seems wrong since the declaration file doesn't accurately describe the types within the file, but it's also very unfortunate that it results in the loss of any documentation added to the constructor.

https://github.com/TypeStrong/typedoc/issues/2577

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 được liên kết bằng cách sử dụng foo.js và so sánh tệp khai báo được phát ra với đầu ra mong đợi. Theo dõi cách JSDoc @private của hàm tạo không có tham số được biểu diễn trong quá trình tạo khai báo. Hoàn tất khi .d.ts được phát ra vẫn giữ lại hàm tạo private và tài liệu của nó mà không thay đổi hành vi truy cập hàm tạo được báo cáo.

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
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
45/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.