mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-10 17:59:53 +03:00
new linting, make sure code is type safe
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { DeviceValueUOM, DeviceValueUOM_s } from './types';
|
||||
import type { TranslationFunctions } from 'i18n/i18n-types';
|
||||
|
||||
import { DeviceValueUOM, DeviceValueUOM_s } from './types';
|
||||
|
||||
const formatDurationMin = (LL: TranslationFunctions, duration_min: number) => {
|
||||
const days = Math.trunc((duration_min * 60000) / 86400000);
|
||||
const hours = Math.trunc((duration_min * 60000) / 3600000) % 24;
|
||||
@@ -24,8 +25,8 @@ const formatDurationMin = (LL: TranslationFunctions, duration_min: number) => {
|
||||
return formatted;
|
||||
};
|
||||
|
||||
export function formatValue(LL: TranslationFunctions, value: any, uom: number) {
|
||||
if (value === undefined) {
|
||||
export function formatValue(LL: TranslationFunctions, value: unknown, uom: DeviceValueUOM) {
|
||||
if (typeof value !== 'number') {
|
||||
return '';
|
||||
}
|
||||
switch (uom) {
|
||||
|
||||
Reference in New Issue
Block a user