Closed nickzelei closed 6 days ago
I don't think TanStack's QueryClient.setQueryData
- which we are using here - can infer data type from the key type. To enforce matching key and value, we'd have to provide our own API to set query data.
Closing in favor of #390.
Hey all, I'm playing with the
createConnectQueryKey
and I'm wondering if there is a way to allow TS to better infer the return type when using it in conjunction with the tanstackqueryclient.setQueryData
.It's able to infer the some of the types, but not all of them. Arguably the most important being the actual value that the cache is going to be updated to.
Screenshot below shows an example. TS is definitely inferring some of the types, but the
updater
is still set tounknown
. It would be awesome if by passing in the query key if theupdater
could be set to the response type, in this case,GetAccountOnboardingConfigResponse