Skip to content

Commit 4b100ce

Browse files
committed
fix(type): update filesize type handling in formatSize and build functions
refs: #289 refs: avoidwork/filesize.js#190
1 parent 911934a commit 4b100ce

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/entries/options/directives/useAdvanceFilter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ const advanceFilterFormat: Record<TAdvanceFilterFormat, IValueFormat> = {
5454
if (typeof value === "number") return value;
5555
else return parseSizeString(value);
5656
},
57-
build: (value: string | number) => filesize(value, { spacer: "" }) as string,
57+
build: (value: string | number) => filesize(value as number, { spacer: "" }) as string,
5858
},
5959
boolean: {
6060
parse: (value: string) => (value ? "1" : "0"),

src/entries/options/utils.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { toRaw, isRef, isReactive, isProxy } from "vue";
2-
import { filesize, type FileSizeOptions } from "filesize";
2+
import { filesize, type FilesizeOptions } from "filesize";
33
import {
44
differenceInDays,
55
differenceInHours,
@@ -40,9 +40,9 @@ export const formValidateRules: Record<string, (args?: any) => (v: any) => boole
4040
},
4141
};
4242

43-
export const formatSize = (size: number | string, options?: FileSizeOptions) => {
43+
export const formatSize = (size: number | string, options?: FilesizeOptions) => {
4444
try {
45-
return filesize(size, { base: 2, ...(options ?? {}) });
45+
return filesize(size as number, { base: 2, ...(options ?? {}) });
4646
} catch (e) {
4747
return size;
4848
}

0 commit comments

Comments
 (0)