Skip to content

Add module-shaped TypeScript client bindings - #6404

Draft
bfops wants to merge 5 commits into
masterfrom
bfops/typescript-module-shaped-bindings
Draft

bfops wants to merge 5 commits into
masterfrom
bfops/typescript-module-shaped-bindings

Conversation

@bfops

@bfops bfops commented Oct 28, 2026 •

Copy link
Copy Markdown
Collaborator

Implement module-shaped TypeScript client declarations and an SDK factory, preserving the generated client API through a thin entry point. Retain legacy bindings and generation support without changing server syntax or ModuleDef.

This draft starts with the implementation outline; SDK, codegen, CLI, and integration changes will follow.

Validation: representative generated-output snapshots, consumer type tests, runtime integration, and legacy compatibility coverage are planned.

Completed implementation

  • Added spacetimedb/schema and typed createClient, reusing existing builders and client runtime.
  • Default TypeScript generation now emits declarations and a thin entry point preserving existing client imports, classes, and types. --bindings-format legacy retains the previous output.
  • Preserved canonical namespaces, declaration metadata, and visibility filtering without changing server syntax or ModuleDef.
  • Regenerated React and chat template bindings without changing user code.

Validation results

  • Full generated-output snapshots and generated-client compile/run tests: 10 passed (C# cases excluded). Includes both formats, private visibility, submodules, reserved names, and legacy output against published SDK 2.12.0.
  • Declaration runtime/type tests and packaged ESM, CommonJS, browser, and consumer-type checks passed.
  • Existing SDK/shared-builder suites: 84 tests passed, including saved legacy bindings.
  • React and chat template builds, CLI format-option test, changed Rust crate checks, formatting, and focused lint passed.

This remains a draft for review.

Usage and compatibility

Generated bindings now use module declarations; the SDK builds the client API. Existing user imports and calls stay the same. New bindings require the upgraded SDK; older SDKs can use --bindings-format legacy. Existing bindings continue working with the new SDK.

  • Update the docs.

This branch has not been deployed

No deployments
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