How to get ctx.meta?.loadSubsetOptions type safe?
The type of
meta being Record<string, unknown> | undefined, loadSubsetOptions is typed unknown.
Is there a way to make it type safe or I should just cope with @ts-ignore?
7 Replies
extended-salmon•6d ago
we weren't doing this automatically — can you try out the package built here? https://github.com/TanStack/db/pull/869
GitHub
Make ctx.meta.loadSubsetOptions type safe by KyleAMathews · Pull R...
Previously, the module augmentation for @tanstack/query-core that makes ctx.meta?.loadSubsetOptions type-safe was in query.ts. This meant it wasn&#39;t always processed by TypeScript unless som...
correct-apricotOP•5d ago
sry didn't get the notification, checking that right now
it seems like the build does not include the global.d.ts, so the module augmentation is not loaded
here's how @tanstack/query-db-collection looks like:
as you can see,
global.d.ts is not included in the builds, but it's imported by esm/index.d.ts and cjs/index.d.ctsextended-salmon•5d ago
ok thanks for trying — pushed another commit which hopefully fixes it — please try that
correct-apricotOP•4d ago
nice!

correct-apricotOP•4d ago
thank you @Kyle Mathews
extended-salmon•4d ago
Nice! Could you post that on the issue btw?
correct-apricotOP•4d ago
sure