microsoft / microsoft/TypeScript
JSDoc optional property in object
まだ誰も着手していません。
- 主要言語
- Go
- スター
- 111k
- フォーク
- 14.4k
- 平均マージ
- 1日 19時間
- マージ済み PR(30日)
- 117
説明
TypeScript Version: 3.9.x & 4.1.x
Search Terms: jsdoc optional
There seems to be a regression since version 3.9.x where optional params in JSDocs are not converted correctly in declaration files. Several issues were created (linked below) and patches were made, however, it seems that params nested inside objects are still not correctly handled as optional when surrounded by brackets.
Code
/**
* Does Foo
*
* @param {object} opts
* @param {string} [opts.bar] - is optional
* @returns void
*/
function foo(opts ) {
// ..
}
Expected behavior: (as well as actual behavior <=3.8.3)
declare function foo(opts: {
bar?: string;
}): void;
Actual behavior:
declare function foo(opts: {
bar: string;
}): void;
Related Issues:
https://github.com/microsoft/TypeScript/issues/39111 was addressed with https://github.com/microsoft/TypeScript/pull/39487, but it doesn't seem that nested properties were covered in that fix.
https://github.com/microsoft/TypeScript/pull/39123 and https://github.com/microsoft/TypeScript/pull/39457 seem to relate to Closure notation, not sure if they're related.
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず、提供された JSDoc の例を TypeScript 3.9.x と 4.1.x で再現し、生成された宣言を期待されるオプショナルなネストされたプロパティと比較します。次に issue #39111 と pull request #39487 を読んで関連する修正を理解します。ネストされた角括弧付きプロパティが宣言内で ? 付きで出力されれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- javascript, typescript
- 領域
- compilers
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100