mirror of
https://github.com/ajnart/homarr.git
synced 2026-01-30 03:09:19 +01:00
* fix(deps): update tanstack-query monorepo to ^5.21.2 * fix(deps): update tanstack-query monorepo * fix: type issue with transformer * fix: issues with next-auth, updated to next canary * chore: fix type issue in trpc route * chore: fix formatting --------- Co-authored-by: homarr-renovate[bot] <158783068+homarr-renovate[bot]@users.noreply.github.com> Co-authored-by: Meier Lukas <meierschlumpf@gmail.com>
34 lines
926 B
TypeScript
34 lines
926 B
TypeScript
import type { inferRouterInputs, inferRouterOutputs } from "@trpc/server";
|
|
|
|
import type { AppRouter } from "./root";
|
|
import { appRouter } from "./root";
|
|
import { createCallerFactory, createTRPCContext } from "./trpc";
|
|
|
|
/**
|
|
* Create a server-side caller for the tRPC API
|
|
* @example
|
|
* const trpc = createCaller(createContext);
|
|
* const res = await trpc.post.all();
|
|
* ^? Post[]
|
|
*/
|
|
const createCaller = createCallerFactory(appRouter);
|
|
|
|
/**
|
|
* Inference helpers for input types
|
|
* @example
|
|
* type PostByIdInput = RouterInputs['post']['byId']
|
|
* ^? { id: number }
|
|
**/
|
|
type RouterInputs = inferRouterInputs<AppRouter>;
|
|
|
|
/**
|
|
* Inference helpers for output types
|
|
* @example
|
|
* type AllPostsOutput = RouterOutputs['post']['all']
|
|
* ^? Post[]
|
|
**/
|
|
type RouterOutputs = inferRouterOutputs<AppRouter>;
|
|
|
|
export { createTRPCContext, appRouter, createCaller };
|
|
export type { AppRouter, RouterInputs, RouterOutputs };
|