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
15 lines (14 loc) • 1.06 kB
TypeScript
import { Schema, RefinableSchema, TransformableSchema, DefaultableSchema, NullableSchema, PredicateSchema, CustomErrorsSchema } from '../types';
export type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never;
/**
* Intersection schema interface
*/
export interface IntersectionSchema<T> extends Schema<T>, RefinableSchema<T, IntersectionSchema<T>>, TransformableSchema<T, IntersectionSchema<T>>, DefaultableSchema<T, IntersectionSchema<T>>, NullableSchema<T, IntersectionSchema<T>>, PredicateSchema<T, IntersectionSchema<T>>, CustomErrorsSchema<T, IntersectionSchema<T>> {
readonly _tag: 'IntersectionSchema';
readonly schemas: readonly Schema<any>[];
}
/**
* Creates an intersection schema that combines multiple schemas.
* The resulting schema validates that the input satisfies all the provided schemas.
*/
export declare function intersection<T extends [Schema<any>, ...Schema<any>[]]>(schemas: T): IntersectionSchema<UnionToIntersection<T[number] extends Schema<infer U> ? U : never>>;