Deno 2.5 somehow regressed on fetch-related typing, not sure what's
going on here for now adding a bunch of "as any" casts.
This commit is contained in:
Zef Hemel
2025-09-11 08:56:11 +02:00
parent 956b7a947f
commit c48167341f
5 changed files with 16 additions and 8 deletions
+8 -4
View File
@@ -177,10 +177,14 @@ export function monkeyPatchFetch() {
base64Body: encodedBody,
},
);
return new Response(r.base64Body ? base64Decode(r.base64Body) : null, {
status: r.status,
headers: r.headers,
});
// Casting the response to "any" for now, since of weird Deno typing
return new Response(
(r.base64Body ? base64Decode(r.base64Body) : null) as any,
{
status: r.status,
headers: r.headers,
},
);
};
}
+2 -1
View File
@@ -38,7 +38,8 @@ export async function performLocalFetch(
method: req.method,
headers: req.headers,
body: req.base64Body && base64Decode(req.base64Body),
},
// Casting to "any" for now, since of weird Deno typing
} as any,
);
return {
ok: result.ok,
+2 -1
View File
@@ -181,7 +181,8 @@ export class HttpSpacePrimitives implements SpacePrimitives {
{
method: "PUT",
headers,
body: data,
// Casting to any because of weird Deno typing
body: data as any,
},
);
return this.responseToMeta(name, res);
+2 -1
View File
@@ -164,7 +164,8 @@ async function handleLocalFileRequest(
if (data) {
// console.log("Serving from space", path);
return new Response(
data.data,
// Casting to any because of weird Deno typing
data.data as any,
{
headers: {
"Content-type": data.meta.contentType,
+2 -1
View File
@@ -79,7 +79,8 @@ export function sandboxFetchSyscalls(
fetchOptions.headers = fetchOptions.headers ?? {};
const resp = await client.httpSpacePrimitives.authenticatedFetch(
buildProxyUrl(client, url),
fetchOptions,
// Casting this to any because of weird Deno typing
fetchOptions as any,
);
const body = await resp.arrayBuffer();
return {