angular / angular/components

bug(date-adapter): Misleading JSDoc for createDate returns type

オープン 初心者向け
#33,059 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る
area: material/core gemini-triaged P3
主要言語
TypeScript
スター
25k
フォーク
6.8k
平均マージ
1日 8時間
マージ済み PR(30日)
91

説明

### Is this a regression?

- [ ] Yes, this behavior used to work in the previous version

### The previous version in which this bug was not present was

_No response_

### Description

(I don't know if it sould be a bug or docs-bug, because it's about JSDoc that not available in the material doc
website, so I couldn't join a link to the doc and create a docs-bug issue).

In the JSDoc of the DateAdapter createDate method, the returns tag indicates that :
@returns The new date, or null if invalid.
But the method returns type is just D, not D | null so it can't be null.
And in the different implementations of the date adapter, when the params are invalid, an error is throws, not a null return.

### Reproduction

This bug is more a docs-bug, but date-adapter JSDoc is not directly available from the doc website, so I couldn't join a link to create a docs-bug.
The components/src/material/core/datetime/date-adapter.ts, line 110

### Expected Behavior

the returns tag indicates that an error is throws when invalid

### Actual Behavior

the returns tag indicates that null is returned when invalid

### Environment

no specific env

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

components/src/material/core/datetime/date-adapter.ts の110行目付近から始め、createDate メソッドの JSDoc と宣言された戻り値の型を確認してください。無効な入力に対してドキュメント化されている動作を、メソッドの説明および issue で言及されている実装と照合してください。JSDoc が戻り値の型と、入力が無効な場合に何が起こるかを正確に記述していれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
angular, typescript
領域
documentation
issue の種類
ドキュメント
難易度
1/5
見積もり時間
1時間未満
活発さ
静か
明瞭さ
明確に書かれている
初心者へのやさしさ
78/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。