superstruct
superstruct copied to clipboard
[Feature] `one of` or `or` type
Add a one of or or type link in Joi.or()
e.g.
I want to validate that type User has at least one of name or email
interface User {
tel: number;
address: string;
name?: string;
email?: string;
}
wouldn't be enough to create a union of 2 types (one with name required, and other with email required)?
@jakubwolny in my project we have larger interfaces which would require significant code duplication.
Currently I accomplished this with a refine that then checks for one or the other, but would be easier like Joi.or()