From c2970510bc9f01e8255a59c950a1727041c9e29d Mon Sep 17 00:00:00 2001 From: oc-code-06 Date: Tue, 24 Nov 2026 09:58:40 -0600 Subject: [PATCH] Fix #14373: narrow env.BRIDGE before the closure in edge worker.ts TS18048: the ternary checked env.BRIDGE but the arrow closure re-read env.BRIDGE, losing the narrowing. Bind it to a local first. --- 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,