Is there an equivalent to Zod's `coerce`?
Hello, I am trying to convert the following Zod schema to ArkType:
So far, I have this:
But I get errors when using default for
limit and page saying: Argument of type 'number' is not assignable to parameter of type '() => never'.ts(2345) and also the type when hovering over it doesn't seem right:
I assume it's not inferring the types correctly or am I doing something wrong? Is this a right way to emulate Zod's coerce?3 Replies
I'd guess maybe something like Maybe with the default as
"0" instead of 0Oh, close! Your tip + the error messages guided me to this:
It's annoying that I have to use
"0" instead of just 0, but it works! 😄
Thanks!Ah, nice!