Skip to content

Commit

Permalink
fix: invert in/out stages of ZodPipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
jedwards1211 committed Jul 29, 2024
1 parent 9955817 commit bf1851d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,12 @@ export function invert<T extends z.ZodTypeAny>(
const {
_def: { inputSchema, outputSchema, parse, format },
} = schema
return invertible(outputSchema, format, inputSchema, parse)
return invertible(
invert(outputSchema),
format,
invert(inputSchema),
parse
)
}
const { _def } = schema as any as z.ZodPipeline<any, any>
return invert(_def.out).pipe(invert(_def.in))
Expand Down

0 comments on commit bf1851d

Please sign in to comment.