Closed adamdehaven closed 1 month ago
@enkot I'm trying to figure out where the interface needs to be modified; glad to help if you want to take a look
@enkot just bumping this and https://github.com/enkot/nuxt-open-fetch/pull/53 again if possible?
Let me know if I can provide more info
Hi @adamdehaven
Thank you for the issue! Should be fixed in https://github.com/enkot/nuxt-open-fetch/releases/tag/v0.9.4
Environment
Reproduction
https://github.com/adamdehaven/nuxt-open-fetch/tree/chore/query-interface-error
Ensure you checkout the
chore/query-interface-error
branch.If you run the playground with
pnpm dev
you'll notice I also added a<select>
element at the top to demonstrate the reactivity works correctly; it's just an issue with thequery[property]
type interface(s).Describe the bug
Nuxt's
useFetch
(the underlying implementation underuse[client]
allows for passing in reactiveref
values for thequery
property:Clients generated by
nuxt-open-fetch
actually do work with this implementation; however, the type interface shows an error as the properties are typed only to the raw value.Example
Utilizing the
/playground/app.vue
file from this repo, if I change the existing/pet/{petId}
call to this:I see the following TypeScript error:
However, you'll notice if you actually run the playground, not only is the example fully-functional, but it also correctly auto-watches the
query.status
property and runs the query again when thestatus
ref changes.If I change
usePets
to the nativeuseFetch
you'll notice there are no type errors, and thequery.status
property is correctly typed:Additional context
Functionality is correct, but the type interfaces for
query
properties need to allow for both static and reactive values, just like the nativeuseFetch
.Logs
No response