How to access another item in a zod object
For example
If condition.type is X I want the ID to be required
Is this possible to do this in the side zod
object with a refine or something else

3 Replies
the keyword you're looking for is "discriminated union"
not in different objects
here's an example, there are other ways to do it https://codesandbox.io/s/restless-framework-c48qjc?file=/src/index.ts