feat: scaffold monorepo

This commit is contained in:
Yangshun Tay
2022-09-29 16:23:34 +08:00
parent 27a82e8c0f
commit 523d91f920
62 changed files with 19346 additions and 712 deletions

View File

@ -0,0 +1,27 @@
// Src/utils/trpc.ts
import { createReactQueryHooks } from '@trpc/react';
import type { inferProcedureInput, inferProcedureOutput } from '@trpc/server';
import type { AppRouter } from '~/server/router';
export const trpc = createReactQueryHooks<AppRouter>();
/**
* These are helper types to infer the input and output of query resolvers
* @example type HelloOutput = inferQueryOutput<'hello'>
*/
export type inferQueryOutput<
TRouteKey extends keyof AppRouter['_def']['queries'],
> = inferProcedureOutput<AppRouter['_def']['queries'][TRouteKey]>;
export type inferQueryInput<
TRouteKey extends keyof AppRouter['_def']['queries'],
> = inferProcedureInput<AppRouter['_def']['queries'][TRouteKey]>;
export type inferMutationOutput<
TRouteKey extends keyof AppRouter['_def']['mutations'],
> = inferProcedureOutput<AppRouter['_def']['mutations'][TRouteKey]>;
export type inferMutationInput<
TRouteKey extends keyof AppRouter['_def']['mutations'],
> = inferProcedureInput<AppRouter['_def']['mutations'][TRouteKey]>;