From c48167341fb2ccd62c8ff3ac65ea9074d1000b8b Mon Sep 17 00:00:00 2001 From: Zef Hemel Date: Thu, 11 Sep 2025 08:56:11 +0200 Subject: [PATCH] Fixes #1528 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. --- lib/plugos/worker_runtime.ts | 12 ++++++++---- lib/proxy_fetch.ts | 3 ++- lib/spaces/http_space_primitives.ts | 3 ++- web/service_worker.ts | 3 ++- web/syscalls/fetch.ts | 3 ++- 5 files changed, 16 insertions(+), 8 deletions(-) diff --git a/lib/plugos/worker_runtime.ts b/lib/plugos/worker_runtime.ts index ecd7bffb..f5d2e91c 100644 --- a/lib/plugos/worker_runtime.ts +++ b/lib/plugos/worker_runtime.ts @@ -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, + }, + ); }; } diff --git a/lib/proxy_fetch.ts b/lib/proxy_fetch.ts index 8388ec29..31af441e 100644 --- a/lib/proxy_fetch.ts +++ b/lib/proxy_fetch.ts @@ -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, diff --git a/lib/spaces/http_space_primitives.ts b/lib/spaces/http_space_primitives.ts index 50936222..b273bec3 100644 --- a/lib/spaces/http_space_primitives.ts +++ b/lib/spaces/http_space_primitives.ts @@ -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); diff --git a/web/service_worker.ts b/web/service_worker.ts index 401cd91b..a045c4e2 100644 --- a/web/service_worker.ts +++ b/web/service_worker.ts @@ -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, diff --git a/web/syscalls/fetch.ts b/web/syscalls/fetch.ts index 8fb3192e..3f6ce828 100644 --- a/web/syscalls/fetch.ts +++ b/web/syscalls/fetch.ts @@ -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 {