Remove unnecessary type parameters from persistence interfaces#1439
Open
kevin-dp wants to merge 3 commits intoTanStack:mainfrom
Open
Remove unnecessary type parameters from persistence interfaces#1439kevin-dp wants to merge 3 commits intoTanStack:mainfrom
kevin-dp wants to merge 3 commits intoTanStack:mainfrom
Conversation
PersistedCollectionPersistence, PersistenceAdapter, and SQLiteCorePersistenceAdapter were generic over <T, TKey> but all implementations erased these to Record<string, unknown> / string | number internally. The type params were threaded through the entire persistence hierarchy without providing real type safety at the implementation level. Collection-level typing (T, TKey) is fully preserved — it flows from getKey, schema, and other CollectionConfig fields, not from persistence. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
More templates
@tanstack/angular-db
@tanstack/browser-db-sqlite-persistence
@tanstack/capacitor-db-sqlite-persistence
@tanstack/cloudflare-durable-objects-db-sqlite-persistence
@tanstack/db
@tanstack/db-ivm
@tanstack/db-sqlite-persistence-core
@tanstack/electric-db-collection
@tanstack/electron-db-sqlite-persistence
@tanstack/expo-db-sqlite-persistence
@tanstack/node-db-sqlite-persistence
@tanstack/offline-transactions
@tanstack/powersync-db-collection
@tanstack/query-db-collection
@tanstack/react-db
@tanstack/react-native-db-sqlite-persistence
@tanstack/rxdb-db-collection
@tanstack/solid-db
@tanstack/svelte-db
@tanstack/tauri-db-sqlite-persistence
@tanstack/trailbase-db-collection
@tanstack/vue-db
commit: |
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 task
samwillis
approved these changes
Apr 2, 2026
Collaborator
samwillis
left a comment
There was a problem hiding this comment.
LGTM, just need a changeset.
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.
Summary
<T, TKey>) fromPersistedCollectionPersistence,PersistenceAdapter, andSQLiteCorePersistenceAdapter— all implementations already erased these toRecord<string, unknown>/string | numberinternallyT,TKey) is fully preserved — it flows fromgetKey,schema, and otherCollectionConfigfields, not from the persistence layeras unknown ascasts across all platform persistence packagesTest plan
persisted.test-d.ts) confirms end-user collection typing is preserved🤖 Generated with Claude Code