export declare class Ok { readonly value: A; constructor(value: A); chain(f: (_: A) => Result): Result; recover(f: (_: B) => Result): Result; } export declare class Err { readonly reason: B; constructor(reason: B); chain(f: (_: A) => Result): Result; recover(f: (_: B) => Result): Result; } export declare type SpecType = T extends AnySpec ? U : never; export declare type SpecTypes = Ts extends [AnySpec] ? U : Ts extends [AnySpec, ...infer Rest] ? U | SpecTypes : never; export declare type RecordSpecType = R extends Record ? { [K0 in K]: SpecType; } : never; declare type Result = Ok | Err; export declare class EType { readonly expected: string; constructor(expected: string); format(): string; } export declare class ENoKey { readonly key: string; constructor(key: string); format(): string; } export declare class ENotEqual { readonly expected: any; constructor(expected: any); format(): string; } export declare class EAnyOf { readonly errors: Errors[]; constructor(errors: Errors[]); format(): string; } export declare class EPath { readonly key: string; readonly error: Errors; constructor(key: string, error: Errors); get_path_and_error(): [string[], Errors]; format(): string; } declare type Errors = EType | ENoKey | ENotEqual | EAnyOf | EPath; declare type Valid = Result; export declare class LazySpec { readonly thunk: () => AnySpec; constructor(thunk: () => AnySpec); } export declare type SpecFun = (_: any) => Valid; export declare type SpecContainer = { spec: AnySpec; }; export declare type AnySpec = SpecFun | SpecContainer | LazySpec; export declare function lazy(x: () => AnySpec): LazySpec; export declare function string(x: any): Valid; export declare function bigint(x: any): Valid; export declare function bigint_string(x: any): Valid; export declare function number(x: any): Valid; export declare function boolean(x: any): Valid; export declare function nothing(x: any): Valid; export declare function array(f0: AnySpec): SpecFun; export declare function equal(x: A): SpecFun; export declare function anyOf[]>(fs: [...T]): SpecFun>; export declare function spec>, B>(type: A, parser: (_: RecordSpecType) => B): SpecFun; export declare function optional(spec: AnySpec, default_value: A): SpecFun; export declare function map_spec(spec: AnySpec, f: (_: A) => B): SpecFun; export declare function parse(x: any, spec: AnySpec): A; export declare function try_parse(x: any, spec: AnySpec): Valid; export {};