type SchemaPathPart = string | number; type SchemaIssue = { readonly path: readonly SchemaPathPart[]; readonly expected: string; readonly received: string; readonly message: string; }; type SchemaResult = { readonly success: true; readonly data: A; } | { readonly success: false; readonly issues: readonly SchemaIssue[]; }; type AnySchema = Schema; type InferSchema = S extends Schema ? A : never; type SchemaShape = Record; type OptionalKeys = { [K in keyof Shape]: Shape[K] extends Schema ? K : never; }[keyof Shape]; type RequiredKeys = Exclude>; type Simplify = { [K in keyof T]: T[K]; } & {}; type InferObject = Simplify<{ [K in RequiredKeys]: InferSchema; } & { [K in OptionalKeys]?: Exclude, undefined>; }>; type JsonValidatorResult = { readonly success: true; readonly data: A; } | { readonly success: false; readonly error: string; readonly issues?: readonly SchemaIssue[]; }; type JsonValidator = (data: unknown) => JsonValidatorResult; type JsonSchemaLike = Schema | JsonValidator; type AnyJsonSchemaLike = JsonSchemaLike; type InferJsonSchema = V extends Schema ? A : V extends JsonValidator ? A : never; type StringSchemaOptions = { readonly minLength?: number; readonly maxLength?: number; readonly pattern?: RegExp; readonly name?: string; }; type NumberSchemaOptions = { readonly min?: number; readonly max?: number; readonly int?: boolean; readonly finite?: boolean; readonly name?: string; }; type ObjectSchemaOptions = { readonly unknownKeys?: "strip" | "passthrough" | "strict"; readonly name?: string; }; declare class SchemaValidationException extends Error { readonly issues: readonly SchemaIssue[]; constructor(issues: readonly SchemaIssue[]); } declare class ConfigValidationError extends Error { readonly _tag = "ConfigValidationError"; readonly configName: string; readonly issues: readonly SchemaIssue[]; constructor(configName: string, issues: readonly SchemaIssue[]); } declare function isConfigValidationError(error: unknown): error is ConfigValidationError; declare function formatConfigError(error: unknown): string; declare const makeSchemaIssue: (path: readonly SchemaPathPart[], expected: string, received: unknown, message?: string) => SchemaIssue; declare function formatIssues(issues: readonly SchemaIssue[]): string; declare function stringSchema(options?: StringSchemaOptions): Schema; declare function nonEmptyStringSchema(options?: Omit): Schema; declare function emailSchema(): Schema; declare function uuidSchema(): Schema; declare function urlSchema(): Schema; declare function dateIsoSchema(): Schema; declare function numberSchema(options?: NumberSchemaOptions): Schema; declare function intSchema(options?: Omit): Schema; declare function positiveSchema(options?: NumberSchemaOptions): Schema; declare function booleanSchema(name?: string): Schema; declare function unknownSchema(): Schema; declare function anySchema(): Schema; declare function literalSchema(value: Value): Schema; declare function enumSchema(values: Values): Schema; declare function arraySchema(item: S): Schema>>; declare function objectSchema(shape: Shape, options?: ObjectSchemaOptions): Schema>; declare function recordSchema(valueSchema: S): Schema>>; declare function unionSchema(members: Members): Schema>; declare function customSchema(guard: (input: unknown) => input is A, expected: string, message?: string): Schema; declare const schema: Readonly<{ string: typeof stringSchema; nonEmptyString: typeof nonEmptyStringSchema; email: typeof emailSchema; url: typeof urlSchema; uuid: typeof uuidSchema; dateIso: typeof dateIsoSchema; number: typeof numberSchema; int: typeof intSchema; positive: typeof positiveSchema; boolean: typeof booleanSchema; literal: typeof literalSchema; enum: typeof enumSchema; array: typeof arraySchema; object: typeof objectSchema; record: typeof recordSchema; union: typeof unionSchema; optional: (inner: S) => Schema | undefined, true>; nullable: (inner: S) => Schema | null, S["isOptional"]>; unknown: typeof unknownSchema; any: typeof anySchema; custom: typeof customSchema; }>; declare const s: Readonly<{ string: typeof stringSchema; nonEmptyString: typeof nonEmptyStringSchema; email: typeof emailSchema; url: typeof urlSchema; uuid: typeof uuidSchema; dateIso: typeof dateIsoSchema; number: typeof numberSchema; int: typeof intSchema; positive: typeof positiveSchema; boolean: typeof booleanSchema; literal: typeof literalSchema; enum: typeof enumSchema; array: typeof arraySchema; object: typeof objectSchema; record: typeof recordSchema; union: typeof unionSchema; optional: (inner: S) => Schema | undefined, true>; nullable: (inner: S) => Schema | null, S["isOptional"]>; unknown: typeof unknownSchema; any: typeof anySchema; custom: typeof customSchema; }>; type Schema = { readonly _tag: "Schema"; readonly kind: string; readonly name?: string; readonly isOptional: Optional; readonly _parse: (input: unknown, path: readonly SchemaPathPart[]) => SchemaResult; readonly safeParse: (input: unknown) => SchemaResult; readonly parse: (input: unknown) => A; readonly optional: () => Schema; readonly nullable: () => Schema; readonly array: () => Schema; readonly refine: (predicate: (value: A) => boolean, message?: string) => Schema; readonly transform: (fn: (value: A) => B, expected?: string) => Schema; }; declare const Schema: Readonly<{ string: typeof stringSchema; nonEmptyString: typeof nonEmptyStringSchema; email: typeof emailSchema; url: typeof urlSchema; uuid: typeof uuidSchema; dateIso: typeof dateIsoSchema; number: typeof numberSchema; int: typeof intSchema; positive: typeof positiveSchema; boolean: typeof booleanSchema; literal: typeof literalSchema; enum: typeof enumSchema; array: typeof arraySchema; object: typeof objectSchema; record: typeof recordSchema; union: typeof unionSchema; optional: (inner: S) => Schema | undefined, true>; nullable: (inner: S) => Schema | null, S["isOptional"]>; unknown: typeof unknownSchema; any: typeof anySchema; custom: typeof customSchema; }>; declare function isSchema(value: unknown): value is AnySchema; declare function validateValue(data: unknown, validator: JsonSchemaLike): SchemaResult; declare function parseConfig(configName: string, validator: JsonSchemaLike, value: unknown): A; export { type AnyJsonSchemaLike, type AnySchema, ConfigValidationError, type InferJsonSchema, type InferObject, type InferSchema, type JsonSchemaLike, type JsonValidator, type JsonValidatorResult, type NumberSchemaOptions, type ObjectSchemaOptions, Schema, type SchemaIssue, type SchemaPathPart, type SchemaResult, type SchemaShape, SchemaValidationException, type StringSchemaOptions, formatConfigError, formatIssues, isConfigValidationError, isSchema, makeSchemaIssue, parseConfig, s, schema, validateValue };