Skip to content

Commit 7cdae17

Browse files
committed
fix(utils): use export & fix formatValueToMinUnit type
1 parent c9c626f commit 7cdae17

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

packages/utils/lib/__test__/useBatchSettings.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { describe, it, expect, vi } from 'vitest'
2-
import useBatchSettings from '../useBatchSettings'
2+
import { useBatchSettings } from '../useBatchSettings'
33

44
describe('useBatchSettings', () => {
55
const {

packages/utils/lib/format.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ enum SizeOrTimeUnit {
4343
MB = 1024 * 1024,
4444
GB = 1024 * 1024 * 1024,
4545
}
46-
export const formatValueToMinUnit = (value: number, unit: keyof typeof SizeOrTimeUnit) => {
46+
export const formatValueToMinUnit = (value: number, unit: string) => {
4747
if (!(unit in SizeOrTimeUnit)) {
4848
throw new Error(`Invalid unit: ${unit}`)
4949
}
50-
return value * SizeOrTimeUnit[unit]
50+
return value * SizeOrTimeUnit[unit as keyof typeof SizeOrTimeUnit]
5151
}

packages/utils/lib/useBatchSettings.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ enum BatchSettingTypes {
88
InfluxDB = 'influxdb',
99
}
1010

11-
export default (locale: 'zh' | 'en' = 'en') => {
11+
export const useBatchSettings = (locale: 'zh' | 'en' = 'en') => {
1212
const i18n = createI18n({
1313
locale,
1414
messages: {

0 commit comments

Comments
 (0)