lukemorales / query-key-factory

A library for creating typesafe standardized query keys, useful for cache management in @tanstack/query
https://www.npmjs.com/package/@lukemorales/query-key-factory
MIT License
1.16k stars 32 forks source link

Property 'pageParam' does not exist on type '{ queryKey: QueryKey; signal: AbortSignal; meta: Record<string, unknown> | undefined; #89

Open jerrynim opened 5 months ago

jerrynim commented 5 months ago

Hi I'm trying to use createQueryKeys with useInfiniteQuery

when use ctx.pageParam type error occurred

Error Message

Property 'pageParam' does not exist on type '{ queryKey: QueryKey; signal: AbortSignal; meta: Record<string, unknown> | undefined; }'.ts(2339)

my Code is here

  mails: (params) => ({
    queryKey: [params],
    queryFn: (ctx) =>
      getRequest({ ...params, page: ctx.pageParam }),
  }),

is there any way to use createQueryKeys with useInfiniteQuery

AngeelVallem commented 5 months ago

Any updates?

ahammer-sc commented 3 months ago

Also experiencing this error. I believe the type definitions of QueryKeyFactory need to be updated to have signal be optional

apenab commented 4 days ago

I'm facing the same bug