isMapConstraint()
isMapConstraint<
K,V>(schema):schema is MapConstraint<K, V>
Type guard for MapConstraint. Checks that the schema is a map type and has constraint methods.
Type Parametersโ
K: K extends GenericSchemaโ
V: V extends GenericSchemaโ
Parametersโ
schema: GenericSchemaโ
The schema to check
Returns: schema is MapConstraint<K, V>โ
True if the schema is a MapConstraint with constraint methods
Sinceโ
2.0.0
Exampleโ
const schema = map(string(), number()).minSize(1);
if (isMapConstraint(schema)) {
// schema is narrowed to MapConstraint
schema.maxSize(10); // constraint methods available
}