Zod Schema: How to make a field optional OR have a minimum string contraint?
In your case, you consider “” to be the same as undefined (i.e.: when the string is empty, it’s like there’s no string at all). It’s implementable in Zod this way: import { z } from “zod”; import { strict as assert } from “node:assert”; // `myString` is a string that can be either optional … Read more