API: Minor followup changes for #1059 (#1135)

This commit is contained in:
Snarling
2024-03-05 19:42:55 -05:00
committed by GitHub
parent 4aaf845fca
commit d61e12fdd1
3 changed files with 13 additions and 19 deletions
+4
View File
@@ -26,3 +26,7 @@ export const debugType = (v: unknown): string => {
export function assertString(ctx: NetscriptContext, argName: string, v: unknown): asserts v is string {
if (typeof v !== "string") throw errorMessage(ctx, `${argName} expected to be a string. ${debugType(v)}`, "TYPE");
}
export function assertFunction(ctx: NetscriptContext, argName: string, v: unknown): asserts v is () => void {
if (typeof v !== "function") throw errorMessage(ctx, `${argName} expected to be a function ${debugType(v)}`, "TYPE");
}