How to Convert Complex TypeScript Interfaces to Zod Schema? #3885
Unanswered
alan890104
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi everyone,
I'm working on a TypeScript project and need to convert a set of complex interfaces into a Zod schema for runtime validation. Here's a simplified example of the interfaces I'm working with:
My goal is to create Zod schemas for these types, especially for
WithdrawParams
, which involves unions and nested objects. I'm unsure how to handle the more complex parts, like:SingleWithdrawParams
andBalancedWithdrawParams
)withdrawAsset
andnextWithdraw
)NextWithdraw
)The rules:
Could anyone provide guidance or examples of how to translate these interfaces into Zod schemas? Any advice or resources would be greatly appreciated!
Thank you!
Beta Was this translation helpful? Give feedback.
All reactions