import { BaseLiteralType } from '../base/literal.js'; import { IS_OF_TYPE, SUBTYPE, UNIQUE_NAME } from '../../symbols.js'; import type { FieldOptions, Literal, Validation, WithJSONSchema } from '../../types.js'; import { type JSONSchema7 } from 'json-schema'; /** * VineLiteral represents a schema type that matches an exact literal value. * It validates that the input exactly matches the specified literal value, * supporting string, number, boolean, and null literals. * * @example * const schema = vine.literal('admin') * * const result = await vine.validate({ * schema, * data: 'admin' * }) */ export declare class VineLiteral extends BaseLiteralType implements WithJSONSchema { #private; /** * Static collection of all available validation rules for literals */ static rules: { equals: (options: { expectedValue: any; }) => Validation<{ expectedValue: any; }>; }; /** * The subtype identifier for the literal schema field */ [SUBTYPE]: string; /** * Unique name identifier for union type resolution */ [UNIQUE_NAME]: string; /** * Type checker function to determine if a value matches the literal value. * Required for "unionOfTypes" functionality. * * @param value - The value to check * @returns True if the value matches the literal value */ [IS_OF_TYPE]: (value: unknown) => boolean; /** * Creates a new VineLiteral instance with the specified literal value. * * @param value - The exact literal value to match * @param options - Field options like bail mode and nullability * @param validations - Initial set of validations to apply */ constructor(value: Value, options?: FieldOptions, validations?: Validation[]); /** * Clones the VineLiteral schema type. The applied options * and validations are copied to the new instance. * * @returns A cloned instance of this VineLiteral schema */ clone(): this; /** * Converts the schema to JSON Schema format. * Generates an enum constraint with the literal value. */ toJSONSchema(): JSONSchema7; }