diff --git a/package.json b/package.json index b6ab0bb..907f6a1 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "packageManager": "pnpm@8.10.2", "scripts": { "prepare": "pnpm build", - "lint": "eslint .", + "lint": "eslint --max-warnings=0 .", "build": "tsc -p tsconfig.lib.json", "dev": "cd test/fixtures && tsx", "test": "vitest run" diff --git a/src/zod-procedure.ts b/src/zod-procedure.ts index 1d749f3..8449c42 100644 --- a/src/zod-procedure.ts +++ b/src/zod-procedure.ts @@ -1,13 +1,9 @@ -import {Procedure} from '@trpc/server' import {z} from 'zod' import zodToJsonSchema from 'zod-to-json-schema' import type {Result, ParsedProcedure} from './types' function getInnerType(zodType: z.ZodType): z.ZodType { - if (zodType instanceof z.ZodOptional) { - return getInnerType(zodType._def.innerType as z.ZodType) - } - if (zodType instanceof z.ZodNullable) { + if (zodType instanceof z.ZodOptional || zodType instanceof z.ZodNullable) { return getInnerType(zodType._def.innerType as z.ZodType) } if (zodType instanceof z.ZodEffects) {