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
20 lines (19 loc) • 1.13 kB
TypeScript
import { Schema, RefinableSchema, TransformableSchema, DefaultableSchema, NullableSchema, PredicateSchema, CustomErrorsSchema } from '../types';
/**
* Set schema interface
*/
export interface SetSchema<T> extends Schema<Set<T>>, RefinableSchema<Set<T>, SetSchema<T>>, TransformableSchema<Set<T>, SetSchema<T>>, DefaultableSchema<Set<T>, SetSchema<T>>, NullableSchema<Set<T>, SetSchema<T>>, PredicateSchema<Set<T>, SetSchema<T>>, CustomErrorsSchema<Set<T>, SetSchema<T>> {
readonly _tag: 'SetSchema';
readonly elementSchema: Schema<T>;
readonly minSize: (min: number, message?: string) => SetSchema<T>;
readonly maxSize: (max: number, message?: string) => SetSchema<T>;
readonly size: (size: number, message?: string) => SetSchema<T>;
readonly nonEmpty: (message?: string) => SetSchema<T>;
readonly has: (value: T, message?: string) => SetSchema<T>;
readonly subset: (superset: Set<T>, message?: string) => SetSchema<T>;
readonly superset: (subset: Set<T>, message?: string) => SetSchema<T>;
}
/**
* Create a set schema
*/
export declare function set<T>(elementSchema: Schema<T>): SetSchema<T>;