microsoft / microsoft/TypeScript
JSDoc `@private` on constructor without parameters is omitted in declaration files
未關閉
還沒有人認領這個 Issue。
Bug
Domain: Declaration Emit
- 主要語言
- Go
- 星號
- 111k
- 分支
- 14.4k
- 平均合併
- 1 天 19 小時
- 30 天內合併 PR
- 117
描述
🔎 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
💻 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.
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
研究方向
從連結的 TypeScript Playground 重現開始,使用 foo.js,並將產生的宣告檔案與預期輸出進行比較。追蹤無參數建構函式的 @private JSDoc 在宣告產生期間如何表示。完成標準是產生的 .d.ts 保留私有建構函式及其文件,同時不變更回報的建構函式存取行為。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- javascript, typescript
- 領域
- compilers
- Issue 類型
- 缺陷
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 活躍度
- 停滯
- 描述清晰度
- 基本清楚
- 新手友好度
- 45/100