UNPKG

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) 908 B
import { Schema, ValidatorOptions, ValidationError, RefinableSchema, TransformableSchema, DefaultableSchema, NullableSchema } from '../types'; /** * Custom schema interface */ export interface CustomSchema<T> extends Schema<T>, RefinableSchema<T, CustomSchema<T>>, TransformableSchema<T, CustomSchema<T>>, DefaultableSchema<T, CustomSchema<T>>, NullableSchema<T, CustomSchema<T>> { readonly _tag: 'CustomSchema'; } /** * Create a custom schema with a validation function */ export declare function custom<T>(validator: (input: unknown, options?: ValidatorOptions) => T | ValidationError | Promise<T | ValidationError>): CustomSchema<T>; /** * Create a passthrough schema that always succeeds with the input value */ export declare function passthrough<T>(): Schema<T>; /** * Create a lazy schema for recursive definitions */ export declare function lazy<T>(schemaFn: () => Schema<T>): Schema<T>;