unionOf()
unionOf<
S1,S2>(schema1,schema2,message?):UnionSchema<readonly [S1,S2]>
Union schema with specific types for better ergonomics.
Type Parametersβ
S1: S1 extends GenericSchemaβ
S2: S2 extends GenericSchemaβ
Parametersβ
schema1: S1β
First schema.
schema2: S2β
Second schema.
message?: stringβ
Custom error message (optional).
Returns: UnionSchema<readonly [S1, S2]>β
UnionSchema with two schemas.
Sinceβ
2.0.0