aboutsummaryrefslogtreecommitdiff
path: root/examples/lambda.ts
diff options
context:
space:
mode:
authorGravatar Colin McDonnell <colinmcd94@gmail.com> 2022-11-09 15:40:40 -0800
committerGravatar GitHub <noreply@github.com> 2022-11-09 15:40:40 -0800
commitf7f1b604443c030afe29d1059b90f72c69afe081 (patch)
tree8f2397447b2a84dab02850007264b72cc565f5d6 /examples/lambda.ts
parentda257336b0b70df8c31da647496899cf70670000 (diff)
downloadbun-f7f1b604443c030afe29d1059b90f72c69afe081.tar.gz
bun-f7f1b604443c030afe29d1059b90f72c69afe081.tar.zst
bun-f7f1b604443c030afe29d1059b90f72c69afe081.zip
Add bun-types, add typechecking, add `child_process` types (#1475)
* Add bun-types to packages * Improve typing * Fix types in tests * Fix dts tests * Run formatter * Fix all type errors * Add strict mode, fix type errors * Add ffi changes * Move workflows to root * Add workflows * Remove labeler * Add child_process types * Fix synthetic defaults issue * Remove docs * Move scripts * Run prettier * Include examples in typechecking * captureStackTrace types * moved captureStackTrace types to globals * Address reviews Co-authored-by: Colin McDonnell <colinmcd@alum.mit.edu> Co-authored-by: Dylan Conway <dylan.conway567@gmail.com>
Diffstat (limited to 'examples/lambda.ts')
-rw-r--r--examples/lambda.ts24
1 files changed, 12 insertions, 12 deletions
diff --git a/examples/lambda.ts b/examples/lambda.ts
index ab2d5bb2b..da1a7d9ee 100644
--- a/examples/lambda.ts
+++ b/examples/lambda.ts
@@ -35,7 +35,7 @@ var Handler;
try {
Handler = await import(sourcefile);
-} catch (e) {
+} catch (e: any) {
console.error("Error loading sourcefile:", e);
try {
await fetch(
@@ -51,7 +51,7 @@ try {
errorType: e.name,
stackTrace: e?.stack?.split("\n") ?? [],
}),
- }
+ },
);
} catch (e2) {
console.error("Error sending error to runtime:", e2);
@@ -92,7 +92,7 @@ export default {
errorType: e.name,
stackTrace: e?.stack?.split("\n") ?? [],
}),
- }
+ },
);
} catch (e2) {
console.error("Error sending error to runtime:", e2);
@@ -109,7 +109,7 @@ if ("baseURI" in Handler.default) {
var baseURL;
try {
baseURL = new URL(baseURLString);
-} catch (e) {
+} catch (e: any) {
console.error("Error parsing baseURI:", e);
try {
await fetch(
@@ -125,7 +125,7 @@ try {
errorType: e.name,
stackTrace: e?.stack?.split("\n") || [],
}),
- }
+ },
);
} catch (e2) {
console.error("Error sending error to runtime:", e2);
@@ -147,7 +147,7 @@ async function runHandler(response: Response) {
});
// we are done with the Response object here
// allow it to be GC'd
- response = undefined;
+ (response as any) = undefined;
var result: Response;
try {
@@ -155,10 +155,10 @@ async function runHandler(response: Response) {
console.time(`[${traceID}] Run ${request.url}`);
}
result = handlerFunction(request, {});
- if (result && result.then) {
+ if (result && (result as any).then) {
await result;
}
- } catch (e1) {
+ } catch (e1: any) {
if (typeof process.env.VERBOSE !== "undefined") {
console.error(`[${traceID}] Error running handler:`, e1);
}
@@ -172,7 +172,7 @@ async function runHandler(response: Response) {
errorType: e1.name,
stackTrace: e1?.stack?.split("\n") ?? [],
}),
- }
+ },
).finally(noop);
return;
} finally {
@@ -191,7 +191,7 @@ async function runHandler(response: Response) {
errorType: "ExpectedResponseObject",
stackTrace: [],
}),
- }
+ },
);
return;
}
@@ -202,9 +202,9 @@ async function runHandler(response: Response) {
method: "POST",
headers: result.headers,
body: await result.blob(),
- }
+ },
);
- result = undefined;
+ (result as any) = undefined;
}
while (true) {