You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/UserCodeRunner.ts
+24-11Lines changed: 24 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -56,9 +56,13 @@ export class UserCodeRunner {
56
56
57
57
declare global {
58
58
const __args: [${argsTypes.join(', ')}];
59
-
let __result: ${outputType};
59
+
let __result: ${outputType} | Promise<${outputType}>;
60
60
}
61
61
__result = defaultExport(...__args);
62
+
63
+
if ((__result as any) instanceof Promise) {
64
+
__result = await __result;
65
+
}
62
66
`;
63
67
64
68
constexecutionSourceFile=ts.createSourceFile(
@@ -442,11 +446,10 @@ export class ExecutionHarnessTypeError extends UserCodeTypeError {
442
446
this.diagnostic.messageText=`Default export is not a valid function. Expected a default export function with the signature: "(...args: ${this.argumentTypeNode.getText()}) => ${this.outputTypeNode.getText()}".`;
443
447
return;
444
448
}
445
-
446
-
447
449
// Errors in the return type of the user code default export
0 commit comments