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

オープン 初心者向け
#33,059 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

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

調査の方向性

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

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

説明

area: material/core gemini-triaged P3
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

主要言語
TypeScript
スター
25k
フォーク
6.8k
平均マージ
1日 2時間
マージ済み PR(30日)
81

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

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

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

angular/components のほかの issue

angular/components の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

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

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