Torbjørn - Hi!We use zod to validate data com...
Hi!
We use Zod to validate data coming from sanity CMS.
Sanity has this fancy preview mode that uses
@vercel/stega
a package that encodes invisible strings into its output.
This breaks all our z.enums
when we enable the preview mode from sanity since they contain much more than just the string.Solution:Jump to solution
if your goal is to keep the types as if the stega matched ones aren't there you can do something like this
```ts
const MyStringSchema = z.union([...
4 Replies
Does anyone have any ideas of how we can keep our string enums and still let the stega strings through?
I have tried using unions, but they just give us the string type (Not what we want, but its the easiest)
Solution
if your goal is to keep the types as if the stega matched ones aren't there you can do something like this
`
Thank you so much! This is exactly what I was looking for!