CODEBASE: Fix lint errors 2 (#1756)

This commit is contained in:
catloversg
2024-11-07 14:09:11 +07:00
committed by GitHub
parent e3c10e9f0f
commit 36c143b687
48 changed files with 267 additions and 146 deletions
+3 -3
View File
@@ -231,16 +231,16 @@ function parseOnlyRamCalculate(
prefix: string,
obj: object,
ref: string,
): { func: () => number | number; refDetail: string } | undefined => {
): { func: (() => number) | number; refDetail: string } | undefined => {
if (!obj) {
return;
}
const elem = Object.entries(obj).find(([key]) => key === ref);
if (elem !== undefined && (typeof elem[1] === "function" || typeof elem[1] === "number")) {
return { func: elem[1], refDetail: `${prefix}${ref}` };
return { func: elem[1] as (() => number) | number, refDetail: `${prefix}${ref}` };
}
for (const [key, value] of Object.entries(obj)) {
const found = findFunc(`${key}.`, value, ref);
const found = findFunc(`${key}.`, value as object, ref);
if (found) {
return found;
}
+1 -1
View File
@@ -76,7 +76,7 @@ export class Script implements ContentFile {
const ramCalc = calculateRamUsage(this.code, this.filename, this.server, otherScripts);
if (ramCalc.cost && ramCalc.cost >= RamCostConstants.Base) {
this.ramUsage = roundToTwo(ramCalc.cost);
this.ramUsageEntries = ramCalc.entries as RamUsageEntry[];
this.ramUsageEntries = ramCalc.entries;
this.ramCalculationError = null;
return;
}