Skip to content

queryOptions typing errors when calling queryClient methods with ref in query key #7101

@EwenDC

Description

@EwenDC

Describe the bug

Follow on from #6299. It appears the typing issues persist if your queryKey includes any Ref or MaybeRef values, both nested in objects and at the top level.

Your minimal, reproducible example

https://codesandbox.io/p/devbox/tanstack-query-example-vue-basic-forked-3gchjt?file=%2Fsrc%2FPosts.vue%3A12%2C37

Steps to reproduce

  1. Look at src/posts.vue
  2. An erroneous type error should appear on line 15 but not on line 17

Expected behavior

There should be no typing errors, as we have ensured the query options object is valid by passing it through the queryOptions function.

How often does this bug happen?

Every time

Screenshots or Videos

No response

Platform

  • OS: MacOS 14.3.1 (23D60)
  • Browser: Chrome Version 122.0.6261.112 (Official Build) (arm64)

Tanstack Query adapter

vue-query

TanStack Query version

v5.27.5

TypeScript version

v5.1.6

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions