Changelog + misc minor changes

Recovery textarea no longer spellchecks, fixed some "as" type assertions that were not necessary.
This commit is contained in:
omuretsu
2023-03-06 11:45:09 -05:00
parent 759f86d6e5
commit 4ebfdcc4a8
4 changed files with 21 additions and 10 deletions
+3 -3
View File
@@ -33,7 +33,7 @@ import { BaseServer } from "../Server/BaseServer";
import { dialogBoxCreate } from "../ui/React/DialogBox";
import { checkEnum } from "../utils/helpers/enum";
import { RamCostConstants } from "./RamCostGenerator";
import { PositiveInteger } from "../types";
import { isPositiveInteger, PositiveInteger } from "../types";
export const helpers = {
string,
@@ -161,10 +161,10 @@ function number(ctx: NetscriptContext, argName: string, v: unknown): number {
/** Convert provided value v for argument argName to a positive integer, throwing if it looks like something else. */
function positiveInteger(ctx: NetscriptContext, argName: string, v: unknown): PositiveInteger {
const n = number(ctx, argName, v);
if (n < 1 || !Number.isInteger(n)) {
if (!isPositiveInteger(n)) {
throw makeRuntimeErrorMsg(ctx, `${argName} should be a positive integer, was ${n}`, "TYPE");
}
return n as PositiveInteger;
return n;
}
/** Returns args back if it is a ScriptArg[]. Throws an error if it is not. */