-
Notifications
You must be signed in to change notification settings - Fork 119
Fix queryCollectionOptions type error after upgrade #816
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Fix queryCollectionOptions type error after upgrade #816
Conversation
This fixes a TypeScript error where queryCollectionOptions (and other collection options functions) produce Collections that TypeScript reports as missing the compareOptions property. The issue occurred because: 1. The Collection interface extends CollectionImpl but didn't explicitly declare the compareOptions property 2. CollectionImpl has a compareOptions getter, but TypeScript's Pick utility (used in CollectionLike) couldn't properly resolve it from the interface The fix explicitly declares compareOptions as a readonly property in the Collection interface, making it properly accessible for type checking. Fixes the issue reported in Discord where users get: "Type 'Collection<T, string, any, any, any>' is missing properties: comparisonOpts, compareOptions" Related to PR #762 which added defaultStringCollation support.
|
More templates
@tanstack/angular-db
@tanstack/db
@tanstack/db-ivm
@tanstack/electric-db-collection
@tanstack/offline-transactions
@tanstack/powersync-db-collection
@tanstack/query-db-collection
@tanstack/react-db
@tanstack/rxdb-db-collection
@tanstack/solid-db
@tanstack/svelte-db
@tanstack/trailbase-db-collection
@tanstack/vue-db
commit: |
|
Size Change: 0 B Total Size: 86 kB ℹ️ View Unchanged
|
|
Size Change: 0 B Total Size: 3.34 kB ℹ️ View Unchanged
|
This fixes a TypeScript error where queryCollectionOptions (and other collection options functions) produce Collections that TypeScript reports as missing the compareOptions property.
Reported on discord @ https://discord.com/channels/719702312431386674/1438802082382483496
The issue occurred because:
The fix explicitly declares compareOptions as a readonly property in the Collection interface, making it properly accessible for type checking.
Fixes the issue reported in Discord where users get: "Type 'Collection<T, string, any, any, any>' is missing properties: comparisonOpts, compareOptions"
Related to PR #762 which added defaultStringCollation support.
🎯 Changes
✅ Checklist
pnpm test:pr.🚀 Release Impact