Open matowang opened 5 months ago
I think my issue is the same (or very related). Chaining .transform
with .superRefine
skips transform when the input is invalid.
this here:
const uuidSchema = z
.string()
.uuid()
.transform((value) => {
console.log('transform called')
return value
})
.superRefine(() => {
console.log('super refine called')
})
uuidSchema.parse('invalid')
logs super refine called
but not(!) transform called
. Is this a bug or by design? How could I check if transform did successfully in super refine?
Object with nested define doesn't apply transform before superRefine, causing superRefine to not be typesafe.
This parsing should abort early or perform the transformation anyway. Transform isn't applied here.