forked from defunkt/ReefVM
ts is trying to narrow the type too hard
This commit is contained in:
parent
78923b3eff
commit
80183653f4
|
|
@ -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)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user