diff --git a/src/zod-procedure.ts b/src/zod-procedure.ts index 24ef964..31ffb43 100644 --- a/src/zod-procedure.ts +++ b/src/zod-procedure.ts @@ -41,8 +41,8 @@ export function parseProcedureInputs(inputs: unknown[]): Result return parseLiteralInput(mergedSchema) } - if (looksLikeInstanceof(mergedSchema, z.ZodTuple)) { - return parseTupleInput(mergedSchema as z.ZodTuple) + if (looksLikeInstanceof>(mergedSchema, z.ZodTuple)) { + return parseTupleInput(mergedSchema) } if (!acceptsObject(mergedSchema)) { @@ -230,12 +230,12 @@ export function accepts(target: ZodTarget) { const innerType = getInnerType(zodType) if (looksLikeInstanceof(innerType, target.constructor as new (...args: unknown[]) => ZodTarget)) return true if (looksLikeInstanceof(innerType, z.ZodLiteral)) return target.safeParse(innerType.value).success - if (looksLikeInstanceof(innerType, z.ZodEnum)) - return (innerType.options as unknown[]).some(o => target.safeParse(o).success) + if (looksLikeInstanceof(innerType, z.ZodEnum)) return innerType.options.some(o => target.safeParse(o).success) if (looksLikeInstanceof(innerType, z.ZodUnion)) return innerType.options.some(test) - if (looksLikeInstanceof(innerType, z.ZodIntersection)) - return test(innerType._def.left as z.ZodType) && test(innerType._def.right as z.ZodType) - if (looksLikeInstanceof(innerType, z.ZodEffects)) return test(innerType.innerType() as z.ZodType) + if (looksLikeInstanceof>(innerType, z.ZodEffects)) return test(innerType.innerType()) + if (looksLikeInstanceof>(innerType, z.ZodIntersection)) + return test(innerType._def.left) && test(innerType._def.right) + return false } return test