Skip to content

'queryFn' does not exist in type 'OmitKeyof<QueryObserverOptions #9034

@BryanHuntNV

Description

@BryanHuntNV

Describe the bug

After updating from v5.72.2 to v5.73.0 and higher, our options to the plug-in no longer compile.

    const options: VueQueryPluginOptions = {
      enableDevtoolsV6Plugin: true,
      queryClientConfig: {
        defaultOptions: { queries: { queryFn: defaultQueryFn }, mutations: { mutationFn: defaultMutationFn } },
      },
    };

    app.use(VueQueryPlugin, options);

Default query function:

export async function defaultQueryFn({ queryKey }: QueryFunctionContext<readonly unknown[]>) {
  ...
}

Error:

error TS2353: Object literal may only specify known properties, and 'queryFn' does not exist in type 'OmitKeyof<QueryObserverOptions<unknown, Error, unknown, unknown, readonly unknown[], never>, "queryKey" | "queryFn"> & { shallow?: boolean | undefined; }'.

13         defaultOptions: { queries: { queryFn: defaultQueryFn }, mutations: { mutationFn: defaultMutationFn } },

This code compiles just fine with v5.72.2.

Your minimal, reproducible example

https://www.typescriptlang.org/play/?#code/JYWwDg9gTgLgBAbzgRQK4FMoE8BiqB2AxjMBPgMJkzoAeMANHAGoZqZYAKANqgObD4A8mBJkAznAC+cAGZQIIOAHIAAjACG+MRsIBrAPQA3DAFoAjhmxKA3AChb6sViKyCxUvjgATdDPWouGDZsHHwACiQLdgBpdCwpAC4US1w3UQoqWhgAHih0dS8yLniCXXwIAHd8AG0AXQA+AEpEWzg4PJhUKE86u0l7WkhYOEdnQlcidO9ff0CAWVQNdNCwiBEPMSTS8qrmhFb29E7uuF7bfttCcXg19M3mVhTuPgFhO7gAXha29Hx1ACMuOgACLoQwwCAQLhiJgANme-HwSRgUAw9AOUWw5C4wF+MEo+BkwF4SX2bTaPj8ARgbw2pLgmNx90iKVCSUpsyCrM8kkYIEW6ju9P5Sw8bOmVPmAuWPKk6LavPOdiAA

Steps to reproduce

  1. Compile the code

Expected behavior

Code should compile

How often does this bug happen?

Every time

Screenshots or Videos

No response

Platform

All

Tanstack Query adapter

vue-query

TanStack Query version

v5.73.0 and higher

TypeScript version

v5.8.3

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions