Validating Non-Empty 'users' or 'invites' in CreatePostCommand

How can I ensure that at least one of the properties 'users' + 'invites' is provided. I do not want to allow both users + invites to be empty 🤔

export const CreatePostCommand = S.Struct({
  title: S.String,
  description: S.String,

  users: S.Array(User),
  invites: S.Array(EmailInvite),
});
Was this page helpful?