-
-
Notifications
You must be signed in to change notification settings - Fork 128
Closed
Description
Currently the @zenstackhq/trpc plugin only generates client types for React and Next clients. The types for the Nuxt client trpc-nuxt would be a welcome addition.
It's quite trivial to derive from the Next client and would just require a slightly modified generator template.
Here's the modified version I'm actually using, which is analogous to the Next client:
import type { AnyRouter } from '@trpc/server'
import { createTRPCNuxtClient as _createTRPCNuxtClient } from 'trpc-nuxt/client'
import type { ClientType } from '../routers'
import type { DeepOverrideAtPath } from './utils'
type TRPCNuxtClient<TRouter extends AnyRouter> = ReturnType<typeof _createTRPCNuxtClient<TRouter>>
export function createTRPCNuxtClient<
TRouter extends AnyRouter,
TPath extends string | undefined = undefined,
>(...args: Parameters<typeof _createTRPCNuxtClient<TRouter>>) {
const r: TRPCNuxtClient<TRouter> = _createTRPCNuxtClient<TRouter>(...args)
return r as DeepOverrideAtPath<TRPCNuxtClient<TRouter>, ClientType<TRouter>, TPath>
}Would be great if this could make it into the plugin!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels