import type { Constraint } from "./constraint.js"; export type Schema = { readonly marshal: (value: T) => string; readonly unmarshal: (value: string) => T; readonly constraints: Constraint[]; readonly accept: (visitor: Visitor) => U; }; export type MarshalFn = Schema["marshal"]; export type UnmarshalFn = Schema["unmarshal"]; export type ScalarSchema = Schema & { readonly description: string; }; export type EnumSchema = Schema & { readonly members: Record; }; export type URLSchema = Schema & { readonly base: URL | undefined; readonly protocols: string[] | undefined; }; export declare function createString(description: string, constraints: Constraint[]): ScalarSchema; export declare function createEnum(members: Record, marshal: MarshalFn, unmarshal: UnmarshalFn, constraints: Constraint[]): EnumSchema; export declare function createURL(base: URL | undefined, protocols: string[] | undefined, marshal: MarshalFn, unmarshal: UnmarshalFn, constraints: Constraint[]): URLSchema; export declare function createScalar(description: string, marshal: MarshalFn, unmarshal: UnmarshalFn, constraints: Constraint[]): ScalarSchema; export type Visitor = { readonly visitEnum: (e: EnumSchema) => T; readonly visitScalar: (s: ScalarSchema) => T; readonly visitURL: (s: URLSchema) => T; }; export declare class InvalidEnumError extends Error { constructor(members: Record); } type Stringable = { readonly toString: () => string; }; export declare function toString(v: T): string; export {};