-
Notifications
You must be signed in to change notification settings - Fork 125
Closed
Description
When accessing ctx.meta?.loadSubsetOptions inside a queryFn, an error occurs because meta is currently typed as Record<string, unknown> | undefined.
import { parseLoadSubsetOptions, queryCollectionOptions } from '@tanstack/query-db-collection';
import { createCollection } from '@tanstack/react-db';
export const imageTypesCollection = createCollection(
queryCollectionOptions({
queryClient,
schema: imageTypeSchema,
queryKey: ['image-types'],
queryFn: (ctx) => {
// Argument of type 'unknown' is not assignable to parameter of type '{ where?: BasicExpression<boolean> | undefined; orderBy?: OrderBy | undefined; limit?: number | undefined; } | null | undefined'.ts
const params = parseLoadSubsetOptions(ctx.meta?.loadSubsetOptions);
return api.images.getAllTypes({ pageSize: 1_000_000 }, { signal: ctx.signal }).then((res) => res.data);
},
getKey: (item) => item.name,
syncMode: 'on-demand',
}),
);@tanstack/query-db-collection v1.0.0
@tanstack/react-db v0.1.44
react v19.2
typescript v5.9.3
RayVentura, Winwardo and daveycodezkevin-dp
Metadata
Metadata
Assignees
Labels
No labels