diff --git a/src/NetscriptFunctions.ts b/src/NetscriptFunctions.ts index 7066f75b6..7d0b175fd 100644 --- a/src/NetscriptFunctions.ts +++ b/src/NetscriptFunctions.ts @@ -1758,11 +1758,11 @@ const base: InternalAPI = { _options ??= options; const txt = helpers.string(ctx, "txt", _txt); assert(_options, objectAssert, (type) => - helpers.makeRuntimeErrorMsg(ctx, `Invalid type for options: ${type}, should be object.`, "TYPE"), + helpers.makeRuntimeErrorMsg(ctx, `Invalid type for options: ${type}. Should be object.`, "TYPE"), ); if (_options.type !== undefined) { assert(_options.type, stringAssert, (type) => - helpers.makeRuntimeErrorMsg(ctx, `Invalid type for options.type: ${type}, should be string.`, "TYPE"), + helpers.makeRuntimeErrorMsg(ctx, `Invalid type for options.type: ${type}. Should be string.`, "TYPE"), ); options.type = _options.type; const validTypes = ["boolean", "text", "select"]; diff --git a/src/utils/helpers/typeAssertion.ts b/src/utils/helpers/typeAssertion.ts index d5736b857..5f0f3e66e 100644 --- a/src/utils/helpers/typeAssertion.ts +++ b/src/utils/helpers/typeAssertion.ts @@ -12,7 +12,7 @@ export function assert( try { assertFn(v); } catch (type: unknown) { - if (type !== "string") type = "unknown"; + if (typeof type !== "string") type = "unknown"; throw msgFn(type as string); } }