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
17 lines (16 loc) • 769 B
TypeScript
import { Schema, RefinableSchema, TransformableSchema, DefaultableSchema, NullableSchema, CatchAllSchema } from '../types';
/**
* Union schema type
*/
export interface UnionSchema<T> extends Schema<T>, RefinableSchema<T, UnionSchema<T>>, TransformableSchema<T, UnionSchema<T>>, DefaultableSchema<T, UnionSchema<T>>, NullableSchema<T, UnionSchema<T>>, CatchAllSchema<T> {
readonly _tag: 'UnionSchema';
readonly schemas: readonly Schema<any>[];
}
/**
* Create a union schema
*/
export declare function union<T extends readonly [Schema<any>, ...Schema<any>[]]>(schemas: T): UnionSchema<T[number] extends Schema<infer U> ? U : never>;
/**
* Alias for union - Creates a schema that accepts any of the given schemas
*/
export declare const oneOf: typeof union;