add superjson transform
This commit is contained in:
parent
2cdd3b2347
commit
34a2bd7361
@ -66,6 +66,15 @@ export const createTRPCContext = async (opts: CreateNextContextOptions) => {
|
||||
import { initTRPC, TRPCError } from "@trpc/server";
|
||||
import superjson from "superjson";
|
||||
|
||||
superjson.registerCustom<Buffer, number[]>(
|
||||
{
|
||||
isApplicable: (v): v is Buffer => v instanceof Buffer,
|
||||
serialize: (v) => [...v],
|
||||
deserialize: (v) => Buffer.from(v),
|
||||
},
|
||||
"buffer"
|
||||
);
|
||||
|
||||
const t = initTRPC.context<typeof createTRPCContext>().create({
|
||||
transformer: superjson,
|
||||
errorFormatter({ shape }) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user