Skip to content

refactor(cloudflare): use named workers.Binding/SettingsBinding from distilled#838

Open
sam-goodwin wants to merge 1 commit into
mainfrom
claude/compassionate-meninsky-5989c4
Open

refactor(cloudflare): use named workers.Binding/SettingsBinding from distilled#838
sam-goodwin wants to merge 1 commit into
mainfrom
claude/compassionate-meninsky-5989c4

Conversation

@sam-goodwin

Copy link
Copy Markdown
Contributor

distilled now exports the Workers script-upload binding union as named type aliases (alchemy-run/distilled#381), so the Exclude<...>[number] digs go away:

-export type WorkerBinding = Exclude<
-  workers.PutScriptRequest["metadata"]["bindings"],
-  undefined
->[number];
+export type WorkerBinding = workers.Binding;

-export type WorkerSettingsBinding = Exclude<
-  workers.GetScriptScriptAndVersionSettingResponse["bindings"],
-  null | undefined
->[number];
+export type WorkerSettingsBinding = workers.SettingsBinding;
  • Bumps the distilled submodule to pick up the named aliases (and one exported interface per variant, e.g. workers.WorkersBindingKindDurableObjectNamespace2).
  • Optional variant props are now honestly nullable (matching what the runtime schema accepts/decodes), so toRuntimeBinding in LocalWorkerProvider coalesces null to undefined where local-mode helpers expect string | undefined.

Verified with bun tsc -b and live WorkerEnv / WorkerBinding suites against real Cloudflare.

🤖 Generated with Claude Code

…distilled

distilled now exports the Workers script-upload binding union as named
type aliases (alchemy-run/distilled#381), so WorkerBinding and
WorkerSettingsBinding no longer dig them out with
Exclude<...["bindings"], undefined>[number]. Optional variant props are
now honestly nullable (matching the runtime schema), so toRuntimeBinding
coalesces null to undefined where local-mode helpers expect it.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant