-
Notifications
You must be signed in to change notification settings - Fork 6.8k
bug(date-adapter): Misleading JSDoc for createDate returns type #33059
Copy link
Copy link
Open
Labels
P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentAn issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: material/coregemini-triagedLabel noting that an issue has been triaged by geminiLabel noting that an issue has been triaged by geminineeds: clarificationThe issue does not contain enough information for the team to determine if it is a real bugThe issue does not contain enough information for the team to determine if it is a real bug
Metadata
Metadata
Assignees
Labels
P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentAn issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: material/coregemini-triagedLabel noting that an issue has been triaged by geminiLabel noting that an issue has been triaged by geminineeds: clarificationThe issue does not contain enough information for the team to determine if it is a real bugThe issue does not contain enough information for the team to determine if it is a real bug
Is this a regression?
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