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
![No description](https://cdn.answeroverflow.com/1141228448661114920/Screenshot_2023-08-15_at_9.28.34_PM.png)
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