Skip to content

Have you considered using Zod for creating static types? #567

Discussion options

You must be logged in to vote

We are familiar! viem's type inference is powered by our ABIType and it exports Zod schemas for the core ABI types.

In key areas, we already validate requests, transactions, etc. at runtime. It's unlikely that we would add extensive additional runtime validation without a specific reason since it will slow things down (Zod isn't very fast compared to other runtime validators) and most folks use viem with TypeScript anyway.

So for example, viem often uses the `0x${string}` literal type which is fine in small projects but completely breaks in larger projects

Say more. Is it cumbersome to assert strings to `0x${string}` or something else? You can configure the internal types to use whate…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@timbrinded
Comment options

Answer selected by timbrinded
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants