Skip to content
Source
Sign inSign up
TanStack/query

Vue: Type error in wrapper composables after updating to v5 #6174

Send to my agent
Closedcallumacrae(GitHub profile, opens in a new tab) opened this issue 2 comments

Describe the bug

v5 looks awesome, thanks for your work on it! :D

We're using wrapper composables to separate usage logic from implementation (e.g., we don't want to have logic for handling optimistic updating inside our components), but we're still allowing users to pass in tanstack options so that the components can be responsible for stuff like refetch intervals.

The UseQueryOptions type has changed, so we were expecting to have to make some changes, but we're unable to resolve one of the errors. The minimal example looks like code that should 100% work and the error doesn't make much sense, which is why I've opened an issue instead of a discussion!

Interestingly, the error is slightly different on the TS playground than locally. Locally, the error can be fixed by specifying initialData: undefined, but that doesn't fix the issue on TS playground.

Your minimal, reproducible example

https://www.typescriptlang.org/play?#code/JYWwDg9gTgLgBAbzgVwM4FMCKz1QJ4A0cMeY6cAqhtrngPJgzAQB2qcAvnAGZQQhwA5AAEYAQzbiAxgGsA9ADccAWgCOOfIICwAKF0kycAGIQIAJXSpIbcgF5EPUwC44qGFGAsA5pwDcu7mQWKSZWFAwTCBp8AAoIRmY2AH4XKiwNegTWVAAeSIsrbPQAPgBKRF04OCh0GGQoFnD02hiESqq4dVoAaXQ8FwBtQW5TQQBdAnaqsVQ8YM6MoxYY8radDo6auoaHEYgXQQAjMShBTjgZ41MC6wx-dY6OSYeqgDp3+NC2Z6quVDEmKhuMBLMRSOgINw4J9EqhSvcOEA

Steps to reproduce

  1. go to link
  2. see error

Expected behavior

As a user, I'd expect to be able to create wrapper composables, but it looks like what was previously possible is no longer.

How often does this bug happen?

Every time

Screenshots or Videos

No response

Platform

typescript 5.2.2

Tanstack Query adapter

vue-query

TanStack Query version

5.0.0

TypeScript version

5.2.2

Additional context

No response

Sign in to join this conversation.