Alan
Alan
TtRPC
Created by Alan on 7/18/2024 in #❓-help
How to get access to the types generated by the server in the frontend (React)?
I found this. is it the good approach?
import type { AppRouter } from "../../../server";
import type { inferRouterOutputs } from "@trpc/server";

export type RouterOutputs = inferRouterOutputs<AppRouter>;

type Props = {
onSuccess: (data: RouterOutputs["createWorker"]) => void;
};
import type { AppRouter } from "../../../server";
import type { inferRouterOutputs } from "@trpc/server";

export type RouterOutputs = inferRouterOutputs<AppRouter>;

type Props = {
onSuccess: (data: RouterOutputs["createWorker"]) => void;
};
2 replies