veffect
Version:
powerful TypeScript validation library built on the robust foundation of Effect combining exceptional type safety, high performance, and developer experience. Taking inspiration from Effect's functional principles, VEffect delivers a balanced approach tha
21 lines (20 loc) • 1.25 kB
TypeScript
import { Schema, RefinableSchema, TransformableSchema, DefaultableSchema, NullableSchema, PredicateSchema, CustomErrorsSchema } from '../types';
/**
* Map schema interface
*/
export interface MapSchema<K, V> extends Schema<Map<K, V>>, RefinableSchema<Map<K, V>, MapSchema<K, V>>, TransformableSchema<Map<K, V>, MapSchema<K, V>>, DefaultableSchema<Map<K, V>, MapSchema<K, V>>, NullableSchema<Map<K, V>, MapSchema<K, V>>, PredicateSchema<Map<K, V>, MapSchema<K, V>>, CustomErrorsSchema<Map<K, V>, MapSchema<K, V>> {
readonly _tag: 'MapSchema';
readonly keySchema: Schema<K>;
readonly valueSchema: Schema<V>;
readonly minSize: (min: number, message?: string) => MapSchema<K, V>;
readonly maxSize: (max: number, message?: string) => MapSchema<K, V>;
readonly size: (size: number, message?: string) => MapSchema<K, V>;
readonly nonEmpty: (message?: string) => MapSchema<K, V>;
readonly hasKey: (key: K, message?: string) => MapSchema<K, V>;
readonly hasValue: (value: V, message?: string) => MapSchema<K, V>;
readonly entries: (entries: [K, V][], message?: string) => MapSchema<K, V>;
}
/**
* Create a map schema
*/
export declare function map<K, V>(keySchema: Schema<K>, valueSchema: Schema<V>): MapSchema<K, V>;