v3.1.0
Type inference now works (mostly) as expected! While the runtime behavior of the package worked as expected during work on 3.0.0 and was what I had been testing, I somehow was completely unaware that type inference was completely broken. It's a bit embarrassing for me, to be honest. It took more energy than I had anticipated to make it work, but type inferences now behave when using typeof .call
and typeof .context
almost exactly as they do in Zod with z.input<typeof validator>
and z.infer<typeof validator>
/z.output<typeof validator>
. This closes Issues #2 and #5 in the process.
I do say almost, as there is an important note that is worth mentioning. There's a known upstream bug in Zod where using .catchall()
results in bugged TypeScript type inference. While I could have left that behavior in ZodParams for parity with Zod, the sudden introduction of that behavior could break builds (it already broke one of our tests, through no fault of my own), so for the time being I've disabled catchall type inference in ZodParams. When the bug is fixed upstream, I'll reenable that behavior here.
Beyond all of this, there should be no other changes and everything should Just Work™ as expected.