Closed charlie-s closed 3 months ago
You should pass the AppRouter
type to the inferRouterOutputs
export type AppRouter = typeof appRouter
export type RouterOutput = inferRouterOutputs<AppRouter> <== this line
And you'd better write the code somewhere client side then import.
Given this page.vue:
what is the recommended approach to inferring the type in SomeComponent?
I tried the following:
server/trpc/routers/index.ts:
components/SomeComponent.vue:
but this results in the error
A composable that requires access to the Nuxt instance was called outside of a plugin, Nuxt hook, Nuxt middleware, or Vue setup function.
.Before I go deeper down the rabbit hole, I wonder if there's something I couldn't find in the docs that help with this.