import { type RefsStore, type TupleNode } from '@vinejs/compiler/types'; import { BaseType } from '../base/main.js'; import { IS_OF_TYPE, PARSE, UNIQUE_NAME } from '../../symbols.js'; import type { FieldOptions, ParserOptions, SchemaTypes, Validation, WithJSONSchema } from '../../types.js'; import { type JSONSchema7 } from 'json-schema'; /** * VineTuple represents a fixed-length array where each position has a specific schema type. * Unlike VineArray which uses the same schema for all elements, tuples allow different * types at different positions, similar to TypeScript tuples. * * @template Schema - Array of schema types for each tuple position * @template Input - Expected input type for the tuple * @template Output - Output type after validation and transformation * @template CamelCaseOutput - Output type with camelCase property names * * @example * const schema = vine.tuple([ * vine.string(), * vine.number(), * vine.boolean() * ]) * * const result = await vine.validate({ * schema, * data: ['hello', 42, true] * }) */ export declare class VineTuple extends BaseType implements WithJSONSchema { #private; /** * Unique name identifier for union type resolution */ [UNIQUE_NAME]: string; /** * Type checker function to determine if a value is an array. * Required for "unionOfTypes" functionality. * * @param value - The value to check * @returns True if the value is an array */ [IS_OF_TYPE]: (value: unknown) => value is any[]; /** * Creates a new VineTuple instance with position-specific schemas. * * @param schemas - Array of schemas defining validation for each tuple position * @param options - Field options like bail mode and nullability * @param validations - Initial set of validations to apply */ constructor(schemas: [...Schema], options?: FieldOptions, validations?: Validation[]); /** * Allows additional elements beyond the defined tuple length to pass through validation. * By default, tuples enforce exact length matching. This method relaxes that constraint. * * @returns This tuple schema with unknown properties allowed * * @example * const schema = vine.tuple([ * vine.string(), * vine.number() * ]).allowUnknownProperties() * * // Now ['hello', 42, 'extra'] will pass validation */ allowUnknownProperties(): VineTuple; /** * Clones the VineTuple schema including all position schemas, validations, and options. * * @returns A cloned instance of this VineTuple schema */ clone(): this; /** * Converts the tuple schema to JSON Schema format. * * @returns JSON Schema representation of this tuple */ toJSONSchema(): JSONSchema7; /** * Compiles the tuple schema to a compiler node for validation. * * @param propertyName - Name of the property being compiled * @param refs - Reference store for the compiler * @param options - Parser options * @returns Compiled tuple node for validation */ [PARSE](propertyName: string, refs: RefsStore, options: ParserOptions): TupleNode; }