From 109dae07ab3ff7418d772c6bab36c0ce95681c16 Mon Sep 17 00:00:00 2001 From: "Sakamoto, Kazunori" Date: Fri, 13 Sep 2024 16:01:00 +0900 Subject: [PATCH] docs: add comments about superjson --- src/infrastructures/trpcBackend/client.ts | 1 + src/infrastructures/trpcBackend/trpc.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/src/infrastructures/trpcBackend/client.ts b/src/infrastructures/trpcBackend/client.ts index e292d332..6dd126f5 100644 --- a/src/infrastructures/trpcBackend/client.ts +++ b/src/infrastructures/trpcBackend/client.ts @@ -9,5 +9,6 @@ import type { BackendRouter } from './routers'; export const backendTrpcReact = createTRPCReact(); export const backendTrpcReactClient = backendTrpcReact.createClient({ + // Date型を扱えるようにするため、 superjson を導入する。 links: [httpBatchLink({ url: '/api/trpc', transformer: superjson })], }); diff --git a/src/infrastructures/trpcBackend/trpc.ts b/src/infrastructures/trpcBackend/trpc.ts index 50f9b358..c2412b9c 100644 --- a/src/infrastructures/trpcBackend/trpc.ts +++ b/src/infrastructures/trpcBackend/trpc.ts @@ -5,6 +5,7 @@ import superjson from 'superjson'; import type { Context } from './context'; const t = initTRPC.context().create({ + // Date型を扱えるようにするため、 superjson を導入する。 transformer: superjson, });