Skip to content

Remove unnecessary type parameters from persistence interfaces#1439

Open
kevin-dp wants to merge 3 commits intoTanStack:mainfrom
kevin-dp:kevin/remove-persistence-generics-clean
Open

Remove unnecessary type parameters from persistence interfaces#1439
kevin-dp wants to merge 3 commits intoTanStack:mainfrom
kevin-dp:kevin/remove-persistence-generics-clean

Conversation

@kevin-dp
Copy link
Copy Markdown
Contributor

@kevin-dp kevin-dp commented Apr 1, 2026

Summary

  • Removes generic type parameters (<T, TKey>) from PersistedCollectionPersistence, PersistenceAdapter, and SQLiteCorePersistenceAdapter — all implementations already erased these to Record<string, unknown> / string | number internally
  • Collection-level typing (T, TKey) is fully preserved — it flows from getKey, schema, and other CollectionConfig fields, not from the persistence layer
  • Removes ~300 lines of unnecessary generic plumbing and as unknown as casts across all platform persistence packages

Test plan

  • All 51 core persistence tests pass
  • TypeScript type-checks clean across all persistence packages (core, browser, node, electron, cloudflare)
  • Type-test file (persisted.test-d.ts) confirms end-user collection typing is preserved
  • ESLint passes (pre-commit hook)

🤖 Generated with Claude Code

kevin-dp and others added 2 commits April 1, 2026 15:32
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>
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Apr 1, 2026

More templates

@tanstack/angular-db

npm i https://pkg.pr.new/@tanstack/angular-db@1439

@tanstack/browser-db-sqlite-persistence

npm i https://pkg.pr.new/@tanstack/browser-db-sqlite-persistence@1439

@tanstack/capacitor-db-sqlite-persistence

npm i https://pkg.pr.new/@tanstack/capacitor-db-sqlite-persistence@1439

@tanstack/cloudflare-durable-objects-db-sqlite-persistence

npm i https://pkg.pr.new/@tanstack/cloudflare-durable-objects-db-sqlite-persistence@1439

@tanstack/db

npm i https://pkg.pr.new/@tanstack/db@1439

@tanstack/db-ivm

npm i https://pkg.pr.new/@tanstack/db-ivm@1439

@tanstack/db-sqlite-persistence-core

npm i https://pkg.pr.new/@tanstack/db-sqlite-persistence-core@1439

@tanstack/electric-db-collection

npm i https://pkg.pr.new/@tanstack/electric-db-collection@1439

@tanstack/electron-db-sqlite-persistence

npm i https://pkg.pr.new/@tanstack/electron-db-sqlite-persistence@1439

@tanstack/expo-db-sqlite-persistence

npm i https://pkg.pr.new/@tanstack/expo-db-sqlite-persistence@1439

@tanstack/node-db-sqlite-persistence

npm i https://pkg.pr.new/@tanstack/node-db-sqlite-persistence@1439

@tanstack/offline-transactions

npm i https://pkg.pr.new/@tanstack/offline-transactions@1439

@tanstack/powersync-db-collection

npm i https://pkg.pr.new/@tanstack/powersync-db-collection@1439

@tanstack/query-db-collection

npm i https://pkg.pr.new/@tanstack/query-db-collection@1439

@tanstack/react-db

npm i https://pkg.pr.new/@tanstack/react-db@1439

@tanstack/react-native-db-sqlite-persistence

npm i https://pkg.pr.new/@tanstack/react-native-db-sqlite-persistence@1439

@tanstack/rxdb-db-collection

npm i https://pkg.pr.new/@tanstack/rxdb-db-collection@1439

@tanstack/solid-db

npm i https://pkg.pr.new/@tanstack/solid-db@1439

@tanstack/svelte-db

npm i https://pkg.pr.new/@tanstack/svelte-db@1439

@tanstack/tauri-db-sqlite-persistence

npm i https://pkg.pr.new/@tanstack/tauri-db-sqlite-persistence@1439

@tanstack/trailbase-db-collection

npm i https://pkg.pr.new/@tanstack/trailbase-db-collection@1439

@tanstack/vue-db

npm i https://pkg.pr.new/@tanstack/vue-db@1439

commit: 4637e2f

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Collaborator

@samwillis samwillis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just need a changeset.

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