Z
Zod8mo ago
Aidan647

Aidan647 - how can I do validation of zod in zo...

how can I do validation of zod in zod
z.object({
description: z.string(),
example: z.string(),
validate: z.any(),
})
// validate is any zod type

// i.e.
x = {
description: "any",
example: "any",
validate: z.string().nullable(),
}
z.object({
description: z.string(),
example: z.string(),
validate: z.any(),
})
// validate is any zod type

// i.e.
x = {
description: "any",
example: "any",
validate: z.string().nullable(),
}
Solution:
I think something like this should work: ```ts z.object({ description: z.string(), example: z.string(),...
Jump to solution
1 Reply
Solution
Sikari
Sikari8mo ago
I think something like this should work:
z.object({
description: z.string(),
example: z.string(),
validate: z.instanceof(z.ZodSchema),
});
z.object({
description: z.string(),
example: z.string(),
validate: z.instanceof(z.ZodSchema),
});
Want results from more Discord servers?
Add your server