-
-
Notifications
You must be signed in to change notification settings - Fork 431
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: update trpc to use server caller (#814)
* update-trpc * change to next tag
- Loading branch information
1 parent
5070e00
commit 3631f06
Showing
6 changed files
with
61 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,33 @@ | ||
import type { inferRouterInputs, inferRouterOutputs } from "@trpc/server"; | ||
|
||
import type { AppRouter } from "./root"; | ||
import { appRouter } from "./root"; | ||
import { createCallerFactory, createTRPCContext } from "./trpc"; | ||
|
||
export { appRouter, type AppRouter } from "./root"; | ||
export { 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 HelloInput = RouterInputs['example']['hello'] | ||
* @example | ||
* type PostByIdInput = RouterInputs['post']['byId'] | ||
* ^? { id: number } | ||
**/ | ||
export type RouterInputs = inferRouterInputs<AppRouter>; | ||
type RouterInputs = inferRouterInputs<AppRouter>; | ||
|
||
/** | ||
* Inference helpers for output types | ||
* @example type HelloOutput = RouterOutputs['example']['hello'] | ||
* @example | ||
* type AllPostsOutput = RouterOutputs['post']['all'] | ||
* ^? Post[] | ||
**/ | ||
export type RouterOutputs = inferRouterOutputs<AppRouter>; | ||
type RouterOutputs = inferRouterOutputs<AppRouter>; | ||
|
||
export { createTRPCContext, appRouter, createCaller }; | ||
export type { AppRouter, RouterInputs, RouterOutputs }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.