agiledigital / agiledigital/readonly-types
Use fewer type assertions
Đang mở
- Ngôn ngữ chính
- TypeScript
- Star
- 17
- Fork
- 2
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
For example,
```typescript
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
const d = new Date(value as number | string | Date);
```
can _probably_ become:
```typescript
const d = new Date(typeof value === "string" ? value : +value);
```
(courtesy of:)
```typescript
/**
* Converts a Date object to a number.
*/
[Symbol.toPrimitive](hint: "number"): number;
```
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Đánh giá
Issue này chưa được đánh giá.