After reviewing the information on this page, it appears that you can invoke another route on the server side by utilizing the
const caller = route.createCaller({})
method. However, if the route is nested within itself, is it feasible to achieve this by using the this
keyword? If not, what is the alternative approach to calling a route sibling?
import { z } from "zod";
import { router, publicProcedure } from "../trpc";
export const exampleRouter = router({
hi: publicProcedure.query(async () => {
return "Hi there!";
}),
world: publicProcedure.query(async () => {
return "World";
}),
hello: publicProcedure.query(async function () {
const caller = this.createCaller({});
const result = await caller.example.hi();
}),
});