We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent df12fdb commit 9bfc9bdCopy full SHA for 9bfc9bd
ts/ffi-types.ts
@@ -58,3 +58,13 @@ export type QTS_C_To_HostInterruptFuncPointer = Pointer<'C_To_HostInterruptFunc'
58
* for the Emscripten stack.
59
*/
60
export type HeapCharPointer = Pointer<'char'>
61
+
62
+export function assertSync<Args extends any[], R>(fn: (...args: Args) => R): (...args: Args) => R {
63
+ return function mustBeSync(...args: Args): R {
64
+ const result = fn(...args)
65
+ if (result && typeof result === 'object' && result instanceof Promise) {
66
+ throw new Error('Function unexpectedly returned a Promise')
67
+ }
68
+ return result
69
70
+}
0 commit comments