[T3 Connect] TypeScript codegen: type DbConnection.db with a merged interface for Babel/Expo - #6013
Draft
bradleyshep wants to merge 1 commit into
Draft
bradleyshep wants to merge 1 commit into
bradleyshep wants to merge 1 commit into
Conversation
bradleyshep
force-pushed
the
bradley/ts-codegen-db-interface
branch
from
September 30, 2026 17:38
4bec9b6 to
884f4d8
Compare
Generated TypeScript bindings narrowed `db` with `declare db: DbView;`. Babel rejects `declare` class fields unless `allowDeclareFields` is set, and babel-preset-expo does not set it, so React Native and Expo apps could not bundle generated bindings for any module with snake_case table accessor aliases. Declare the narrowed type on an interface merged into the class instead. It is type-only like before and emits nothing in any transpiler. Updated the codegen snapshot and the checked-in bindings to match.
bradleyshep
force-pushed
the
bradley/ts-codegen-db-interface
branch
from
October 1, 2026 17:26
884f4d8 to
080dc12
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of Changes
Generated TypeScript bindings narrowed
dbwithdeclare db: DbView;. Babel rejectsdeclareclass fields unlessallowDeclareFieldsis set, andbabel-preset-expodoesn't set it. So React Native and Expo apps couldn't bundle generated bindings for any module with snake_case table accessor aliases.Codegen now declares the narrowed type on an interface merged into the class. Like before, it's type-only. The snapshots are updated.
One linter difference: Biome's default
noUnsafeDeclarationMergingrule reports the merged interface (ESLint and oxlint don't, and the generated header already disables ESLint). Projects that lint generated bindings with Biome would need to exclude them.Split out of #6006.
Companion: clockworklabs/spacetime-web#1395 updates the website's generated control database bindings. The "Check spacetime-web bindings" job compares against spacetime-web
mainfor public PRs, so it fails here until that merges; the two should land together.API and ABI breaking changes
None. Generated code has the same type and the same runtime output.
Rollback safety impact
n/a
Expected complexity level and risk
Testing
pnpm buildandpnpm testincrates/bindings-typescript(322 passing)tsc, esbuild, swc and Babel, withuseDefineForClassFieldson and offbabel-preset-exporejects the old bindings ("The 'declare' modifier is only allowed when…") and accepts the new onescargo test -p spacetimedb-codegen