Skip to content

Commit d0e4218

Browse files
committed
fix: 添加ts类型
1 parent c55bb3f commit d0e4218

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

ui/src/utils/time.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import moment from 'moment'
44
export const nowDate = moment().format('YYYY-MM-DD')
55

66
// 当前时间的前n天
7-
export function beforeDay(n) {
7+
export function beforeDay(n: number | string) {
88
return moment().subtract(n, 'days').format('YYYY-MM-DD')
99
}
1010

ui/src/utils/utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,13 @@ export function isAllPropertiesEmpty(obj: object) {
6666
}
6767

6868
// 数组对象中某一属性值的集合
69-
export function getAttrsArray(array, attr) {
69+
export function getAttrsArray(array: Array<any>, attr: string) {
7070
return array.map((item) => {
7171
return item[attr]
7272
})
7373
}
7474

7575
// 求和
76-
export function getSum(array) {
76+
export function getSum(array: Array<any>) {
7777
return array.reduce((totol, item) => totol + item, 0)
7878
}

0 commit comments

Comments
 (0)