feng
feng
TtRPC
Created by feng on 6/28/2024 in #❓-help
How to use output validation for dates? (Zod, SuperJSON)
I am trying to add output validation with zod, and my defined zod schema. I have currently set up superJson to transform my objects to and from, so that it can also do date transformation. If I add .output(ZodSchemaObject) it throws Expected date, received string This is becuse the ZodSchemaObject has a date in it. However I'm not sure how to make it so that it does the validation BEFORE the SuperJSON has had a chance to transform to string (is this correct?) to send to the client. Has anyone else had any success with this? Only solution now is to remove output validation and risk returning too much data
5 replies