Skip to content

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

Closed
illkle wants to merge 2 commits into
TanStack:mainfrom
illkle:main
Closed

illkle wants to merge 2 commits into
TanStack:mainfrom
illkle:main

Conversation

@illkle

@illkle illkle commented Feb 19, 2026

Copy link
Copy Markdown
Contributor

🎯 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

changeset-bot Bot commented Feb 19, 2026

Copy link
Copy Markdown

🦋 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

@KyleAMathews

Copy link
Copy Markdown
Collaborator

Closing as superseded by merged PR #1831, which includes portable public declarations together with the PowerSync 2 runtime and typing repairs, and preserves the original contributor credit.

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.

2 participants