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

View File

@@ -66,7 +66,7 @@ class NSProxyHandler<API extends GenericAPI<API>> {
const descriptor = Object.getOwnPropertyDescriptor(this.ns, key);
if (!descriptor) return descriptor;
const field = descriptor.value;
const field: unknown = descriptor.value;
if (typeof field === "function") {
const arrayPath = [...this.tree, key];
@@ -74,7 +74,7 @@ class NSProxyHandler<API extends GenericAPI<API>> {
const ctx = { workerScript: this.ws, function: key, functionPath };
// Only do the context-binding once, instead of each time the function
// is called.
const func: any = field(ctx);
const func = field(ctx) as (...args: unknown[]) => unknown;
const wrappedFunction = function (...args: unknown[]): unknown {
// What remains *must* be called every time.
helpers.checkEnvFlags(ctx);

View File

@@ -692,8 +692,11 @@ function getRunningScript(ctx: NetscriptContext, ident: ScriptIdentifier): Runni
return findRunningScriptByPid(ident);
} else {
const scripts = getRunningScriptsByArgs(ctx, ident.scriptname, ident.hostname, ident.args);
if (scripts === null) return null;
return scripts.values().next().value ?? null;
if (scripts === null) {
return null;
}
const next = scripts.values().next();
return !next.done ? next.value : null;
}
}