Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[vue-query]: invalid inferred type for computed queryKey readonly unknown[] in queryOptions #7420

Open
MellKam opened this issue May 12, 2024 · 1 comment

Comments

@MellKam
Copy link

MellKam commented May 12, 2024

Describe the bug

import { queryOptions } from "@tanstack/vue-query"
import { computed } from "vue"

queryOptions({
    queryKey: ["hello"],
    queryFn: ({ queryKey }) => {
        queryKey
        // ^? (parameter) queryKey: string[]
    }
})

queryOptions({
    queryKey: computed(() => ["hello"]),
    queryFn: ({ queryKey }) => {
        queryKey
        // ^? (parameter) queryKey: readonly unknown[]
		// the type should be the same as in the first example without computed
    }
})

I noticed this after upgrading to the latest version of vue-query (5.35.5) from 5.29.0

Your minimal, reproducible example

typescript playground reproduction

Tanstack Query adapter

vue-query

TanStack Query version

5.35.5

TypeScript version

5.4.5

@MellKam MellKam changed the title [vue-query]: invalid inferred type for computed queryKey readonly unknown[] [vue-query]: invalid inferred type for computed queryKey readonly unknown[] in queryOptions May 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants