From ba874a33ac57ae5bb1e0a708c4f511da7e70ac02 Mon Sep 17 00:00:00 2001 From: Malo Guertin Date: Sat, 4 Feb 2023 14:20:10 -0500 Subject: [PATCH] Fix/prevent serializing symbols (#3) * fix: prevent serializing symbols * bump version --------- Co-authored-by: malo --- package.json | 2 +- src/createTRPCMsw.ts | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 0a21bd9..e9d4344 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "msw-trpc", - "version": "1.1.1", + "version": "1.1.2", "description": "Trpc API for Mock Service Worker (MSW).", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/src/createTRPCMsw.ts b/src/createTRPCMsw.ts index 86e5cd5..bbccc2c 100644 --- a/src/createTRPCMsw.ts +++ b/src/createTRPCMsw.ts @@ -82,7 +82,7 @@ const createTRPCMsw = ( type ExtractKeys = T[K] extends | BuildProcedure<'query', any, any> | BuildProcedure<'mutation', any, any> - | Router[any] + | AnyRouter ? K : never @@ -128,11 +128,11 @@ const createTRPCMsw = ( ? Mutation : T[K] extends BuildProcedure<'query', any, any> ? Query - : T[K] extends Router[any] + : T[K] extends AnyRouter ? MswTrpc : never - type MswTrpc = { + type MswTrpc = { [key in keyof T as ExtractKeys]: ExtractProcedureHandler }