How to get access to the types generated by the server in the frontend (React)?
In this example, how do you replace
data: any to the correct type?data: anyimport { trpc } from "../utils/trpc";
type Props = {
onSuccess: (data: any) => void;
};
export function CreateWorker(props: Props) {
const createWorkerMutation = trpc.createWorker.useMutation();
const handleCreateWorker = () => {
createWorkerMutation.mutate(
{ data: "hello" },
{
onSuccess: (data) => props.onSuccess(data),
}
);
};
return <button onClick={handleCreateWorker}>create</button>;
}