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
23 lines (22 loc) • 962 B
TypeScript
/**
* Unknown Schema implementation
*/
import { Schema, RefinableSchema, TransformableSchema } from '../types';
export interface UnknownSchema extends Schema<unknown>, RefinableSchema<unknown, UnknownSchema>, TransformableSchema<unknown, UnknownSchema> {
readonly _tag: 'UnknownSchema';
}
export interface TransformedUnknownSchema<T> extends Schema<T> {
readonly _tag: 'TransformedSchema';
refine: (refinement: (value: T) => boolean | Promise<boolean>, message?: string | ((value: T) => string)) => TransformedUnknownSchema<T>;
transform: <U>(transformer: (value: T) => U) => TransformedUnknownSchema<U>;
}
/**
* Creates a schema that validates unknown values (accepts any value but preserves type safety)
*
* @returns A schema that validates unknown values
*
* @example
* const unknownSchema = unknown();
* unknownSchema.toValidator().parse("anything"); // => "anything" as unknown
*/
export declare function unknown(): UnknownSchema;