From 40d39c174812dbe2d1fded9bde4653451c6795a2 Mon Sep 17 00:00:00 2001 From: Drewry Pope Date: Tue, 24 Nov 2026 09:53:24 -0600 Subject: [PATCH] fix(pm-console-edge): keep BRIDGE narrowed in the bridgeFetch closure Hoist env.BRIDGE into a local so the optional binding stays narrowed inside the arrow function; fixes TS18048 in the deploy type-check (#14373). --- pm-stack/console/edge/src/worker.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pm-stack/console/edge/src/worker.ts b/pm-stack/console/edge/src/worker.ts index 098724324..96f539c03 100644 --- a/pm-stack/console/edge/src/worker.ts +++ b/pm-stack/console/edge/src/worker.ts @@ -80,6 +80,7 @@ export class PmEdge extends DurableObject { // The app says "ping" to keep its connection from being dropped as // idle; the platform answers "pong" itself, without waking this. ctx.setWebSocketAutoResponse(new WebSocketRequestResponsePair("ping", "pong")); + const bridge = env.BRIDGE; this.edge = new Edge({ fetchImpl: keysFetch(env), kv: { @@ -96,9 +97,9 @@ export class PmEdge extends DurableObject { bridgeToken: env.BRIDGE_TOKEN, // The binding's fetch, shaped as the fetch the classes take: // not to be called as a method, like the platform's own. - bridgeFetch: env.BRIDGE + bridgeFetch: bridge ? (url: string | URL | Request, init?: RequestInit) => - env.BRIDGE.fetch(new Request(url as string, init)) + bridge.fetch(new Request(url as string, init)) : undefined, githubApi: env.GITHUB_API_ORIGIN, queueDb: env.QUEUE_DB_ORIGIN,