Alan_szt
Alan_szt
TtRPC
Created by Alan_szt on 7/18/2024 in #❓-help
How to get access to the types generated by the server in the frontend (React)?
3 replies
TtRPC
Created by Alan_szt 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;
};
3 replies