The parameter type Schema extends z.AnyZodObject shoudl be SchemaType extends z.ZodTypeAny to support all root level types including discriminative types, arrays, etc.
Also the typing of the response should be:
validData: Partial<z.output<Schema>>; // type after transforms, pipes
invalidData: Partial<z.input<Schema>>; // type before any zod transformation
The parameter type
Schema extends z.AnyZodObjectshoudl beSchemaType extends z.ZodTypeAnyto support all root level types including discriminative types, arrays, etc.Also the typing of the response should be: