Skip to content

fix(powersync-db-collection): additional export to make type definitions portable#1277

Open
illkle wants to merge 2 commits intoTanStack:mainfrom
illkle:main
Open

fix(powersync-db-collection): additional export to make type definitions portable#1277
illkle wants to merge 2 commits intoTanStack:mainfrom
illkle:main

Conversation

@illkle
Copy link

@illkle illkle commented Feb 19, 2026

🎯 Changes

In monorepo setups you might have something like this:

  • packages/db/powersync/schema.ts
  • web/db/powersync.ts // new PowerSyncDatabase({database: WaSqlite, schema: SchemaFromSharedPackage}
  • expo/db/powersync.ts // new PowerSyncDatabase({database: opSqlite, schema: SchemaFromSharedPackage}
  • packages/db/tanstack-db/index.ts

However currently it's not possible to make a function that will take db: AbstractPowerSyncDatabase and return a tanstack collection due to type issues.

Error is:

The inferred type of 'createTanstackCollection' cannot be named without a reference to '../../../../node_modules/@tanstack/powersync-db-collection/dist/esm/helpers'. This is likely not portable. A type annotation is necessary

Collection type looks like this

type SomeCollection = Collection<OptionalExtractedTable<SomeTableType>, string, PowerSyncCollectionUtils<SomeTableType> never,OptionalExtractedTable<SomeTableType>> &  NonSingleResult;

The only export missing from @tanstack/powersync-db-collection is OptionalExtractedTable.

Video demonstration of me patching node_modules and the typescript issue going away

2026-02-20.at.00.34.23.mp4

✅ Checklist

  • I have tested this code locally with pnpm test.

🚀 Release Impact

  • This change affects published code, and I have generated a changeset.
  • This change is docs/CI/dev-only (no release).

@changeset-bot
Copy link

changeset-bot bot commented Feb 19, 2026

🦋 Changeset detected

Latest commit: abd6572

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@tanstack/powersync-db-collection Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

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

Comments