ZodZ
Zod16mo ago
3 replies
Haddok

Haddok - hi , i have defined a schema where i a...

hi , i have defined a schema where i am accessing a few fields using shape for some specific scenario

i tried using

myschema.shape[fieldname].safeparse(value)

this throws error that

myschema.shape[fieldname] is undefined

is there any way to access shapes with passed value ?

for context myschema.shape.name.safeparse(value) works fine, i just want to create a generic function for different fields of the form
Was this page helpful?