Compare commits

..

2 Commits

Author SHA1 Message Date
0bb0af6c1e ok 2025-10-08 10:01:35 -07:00
80183653f4 ts is trying to narrow the type too hard 2025-10-08 10:01:06 -07:00
2 changed files with 2 additions and 4 deletions

View File

@ -26,9 +26,7 @@ export class VM {
this.scope = new Scope() this.scope = new Scope()
} }
registerFunction(name: string, fn: NativeFunction | Function) { registerFunction(name: string, fn: Function) {
// If it's already a NativeFunction, use it directly
// Otherwise, assume it's a JS function and wrap it
const wrapped = isWrapped(fn) ? fn as NativeFunction : wrapNative(fn) const wrapped = isWrapped(fn) ? fn as NativeFunction : wrapNative(fn)
this.nativeFunctions.set(name, wrapped) this.nativeFunctions.set(name, wrapped)
} }

View File

@ -128,7 +128,7 @@ test("CALL_NATIVE - function not found", async () => {
const vm = new VM(bytecode) const vm = new VM(bytecode)
await expect(vm.run()).rejects.toThrow('CALL_NATIVE: function not found: nonexistent') expect(vm.run()).rejects.toThrow('CALL_NATIVE: function not found: nonexistent')
}) })
test("CALL_NATIVE - using result in subsequent operations", async () => { test("CALL_NATIVE - using result in subsequent operations", async () => {