Convert all remaining files to typescript.

This commit is contained in:
Jas Singh
2024-07-26 23:11:33 -07:00
parent ca5dcc629b
commit b511d76e11
84 changed files with 2075 additions and 1987 deletions

View File

@@ -1,11 +1,12 @@
import options from "options";
import { GPU_Stat } from "lib/types/gpustat";
const { terminal } = options;
const Stats = () => {
const divide = ([total, free]) => free / total;
const formatSizeInGB = (sizeInKB) =>
const formatSizeInGB = (sizeInKB: number) =>
Number((sizeInKB / 1024 ** 2).toFixed(2));
const cpu = Variable(0, {
@@ -73,8 +74,10 @@ const Stats = () => {
const totalGpu = 100;
const usedGpu =
data.gpus.reduce((acc, gpu) => acc + gpu["utilization.gpu"], 0) /
data.gpus.length;
data.gpus.reduce((acc: number, gpu: GPU_Stat) => {
return acc + gpu["utilization.gpu"]
}, 0) / data.gpus.length;
return divide([totalGpu, usedGpu]);
} catch (e) {