// A `ValidationError` is either a `string` with the value of the error, // otherwise `null | undefined` to signal that there is no error. type ValidationError = string | null | undefined; export type ValidationResult = TValue extends Array ? Record> | ValidationError : TValue extends object ? | { [TKey in keyof TValue]?: ValidationResult } | ValidationError : ValidationError;