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 }