bug(date-adapter): Misleading JSDoc for createDate returns type
- Ngôn ngữ chính
- TypeScript
- Star
- 25k
- Fork
- 6.8k
- Merge trung bình
- 1 ngày 8 giờ
- Pull request đã merge (30 ngày)
- 91
Mô tả
### 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
Hướng dẫn đóng góp
Hướng nghiên cứu
Bắt đầu tại components/src/material/core/datetime/date-adapter.ts, khoảng dòng 110, và kiểm tra JSDoc của phương thức createDate cùng với kiểu trả về được khai báo. Xác nhận hành vi được ghi lại đối với đầu vào không hợp lệ bằng cách đối chiếu với mô tả phương thức và các triển khai được đề cập trong issue. Hoàn tất khi JSDoc mô tả chính xác kiểu trả về và điều xảy ra khi đầu vào không hợp lệ.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- angular, typescript
- Lĩnh vực
- documentation
- Loại issue
- Tài liệu
- Độ khó
- 1/5
- Thời gian dự kiến
- Dưới một giờ
- Mức độ hoạt động
- Ít trao đổi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức phù hợp với người mới
- 78/100