import { CombinedStandardProps, Result, Schema } from "./types.mjs"; //#region src/core/base.d.ts declare abstract class BaseSchema implements Schema { abstract get ["~standard"](): CombinedStandardProps; jsonSchema: any; get inferred(): O; schema: Schema; protected _coerce: boolean; /** * Enable coercion for the schema. * @returns {this} The schema with coercion enabled. */ coerce(): this; /** * Mark schema as optional (allows undefined / null on input). * @returns {OptionalSchema} Optional schema wrapper. */ optional(): OptionalSchema; /** * Allow `null` in addition to the existing schema output. * @returns {UnionSchema} Union with null. */ null(): UnionSchema; /** * Alias for {@link BaseSchema.null}. * @returns {UnionSchema} Union with null. */ nullable(): UnionSchema; /** * Build an enum schema from this schema's literal type. * @param {Values} values List of allowed literal values. * @returns {UnionSchema} Union of literals. */ enum(values: Values): UnionSchema; /** * Wrap the schema in an array schema. * @returns {ArraySchema} Array schema. */ array(): ArraySchema; /** * Restrict to instances of the given constructor. * @param {C} constructor Class constructor. * @returns {InstanceOfSchema>} Instance-of schema. */ instanceOf any>(constructor: C): InstanceOfSchema>; /** * Validate value and throw if invalid. * @param {unknown} value Value to validate. * @returns {O | Promise} Validated value. */ parse(value: unknown): O | Promise; /** * Validate value and return a result object. * @param {unknown} value Value to validate. * @returns {Result | Promise>} Validation result. */ safeParse(value: unknown): Result | Promise>; } declare class OptionalSchema extends BaseSchema { private readonly innerSchema; constructor(schema: Schema); get ["~standard"](): CombinedStandardProps; } declare class NullSchemaType extends BaseSchema { readonly type = "null"; constructor(); get ["~standard"](): CombinedStandardProps; } declare class LiteralSchema extends BaseSchema { private readonly value; constructor(value: T); get ["~standard"](): CombinedStandardProps; } declare class UnionSchema extends BaseSchema { readonly schemas: Schema[]; constructor(...schemas: Schema[]); get ["~standard"](): CombinedStandardProps; } declare class ArraySchema extends BaseSchema { private readonly innerSchema; private _minLength?; private _maxLength?; private _nonEmpty; constructor(schema: Schema); /** * Require minimum number of items. * @param {number} n Minimum length. * @returns {ArraySchema} New constrained schema. */ min(n: number): ArraySchema; /** * Require maximum number of items. * @param {number} n Maximum length. * @returns {ArraySchema} New constrained schema. */ max(n: number): ArraySchema; /** * Require array to contain at least one item. * @returns {ArraySchema} New constrained schema. */ nonEmpty(): ArraySchema; get ["~standard"](): CombinedStandardProps; } declare class InstanceOfSchema extends BaseSchema { private readonly innerSchema; private readonly classConstructor; constructor(schema: Schema, classConstructor: new (...args: any[]) => any); get ["~standard"](): CombinedStandardProps; } declare function validatePrimitive(schema: "string" | "number" | "boolean" | "any", value: unknown): boolean; //#endregion export { ArraySchema, BaseSchema, InstanceOfSchema, LiteralSchema, NullSchemaType, OptionalSchema, UnionSchema, validatePrimitive }; //# sourceMappingURL=base.d.mts.map