Skip to main content

intersection()

intersection<S1, S2>(schema1, schema2, message?): IntersectionSchema<readonly [S1, S2]>

Intersection schema - validates that the value satisfies multiple schemas.


Type Parameters​

S1: S1 extends GenericSchema​

S2: S2 extends GenericSchema​


Parameters​

schema1: S1​

First schema.

schema2: S2​

Second schema.

message?: string​

Custom error message.


Returns: IntersectionSchema<readonly [S1, S2]>​

Schema that validates the intersection of both schemas.


Since​

2.0.0