-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
getCachedData
makes useAsyncData
resolve to type any
#26761
Labels
Comments
Same as #25903. `Nuxt 3.11.2`
// data is 'number' (it should be a... string?)
const { data } = useAsyncData(async () => "this is a string", {
getCachedData: () => 2,
});
// data2 is 'any' (it should be a string, right?)
const { data: data2 } = useAsyncData(async () => "this is a string", {
getCachedData: (key) => useNuxtApp().payload.data[key],
}); IMHO the handler should choose the types and not |
Closing here as #25946 resolved it 👍🏻 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Environment
Reproduction
https://github.com/warflash/nuxt-cached-data-type
Tested for TypeScript 5.4.3 and 5.4.5 in vscode and vscode insiders.
Describe the bug
Not setting getCachedData:
With getCachedData:
Additional context
No response
Logs
No response
The text was updated successfully, but these errors were encountered: