@vinejs/vine - v4.0.0-next.1
    Preparing search index...

    Interface ConstructableLiteralSchema<Inputs, Output, CamelCaseOutput>

    Specialized interface for literal schema types (string, number, boolean, etc.). Extends ConstructableSchema but restricts the compiler output to literal nodes only.

    class NumberSchema implements ConstructableLiteralSchema<number | undefined, number, number> {
    [ITYPE]: number | undefined
    [OTYPE]: number
    [COTYPE]: number

    [PARSE](propertyName: string, refs: RefsStore, options: ParserOptions) {
    return { type: 'literal', subtype: 'number', propertyName, validations: [] }
    }

    clone() { return new NumberSchema() }
    }
    interface ConstructableLiteralSchema<Inputs, Output, CamelCaseOutput> {
        "[ITYPE]": Inputs;
        "[OTYPE]": Output;
        "[COTYPE]": CamelCaseOutput;
        "[PARSE]"(
            propertyName: string,
            refs: RefsStore,
            options: ParserOptions,
        ): FieldNode & {} & { subtype: string };
        clone(): this;
        "[UNIQUE_NAME]"?: string;
        "[IS_OF_TYPE]"?: (value: unknown, field: FieldContext) => boolean;
    }

    Type Parameters

    • Inputs

      The expected input type before validation

    • Output

      The validated output type

    • CamelCaseOutput

      The output type with camelCase field names

    Implemented by

    Index

    Properties

    "[ITYPE]": Inputs

    Type marker for input type inference

    "[OTYPE]": Output

    Type marker for output type inference

    "[COTYPE]": CamelCaseOutput

    Type marker for camelCase output type inference

    "[UNIQUE_NAME]"?: string

    Unique identifier for the schema type. Implement if you want schema type to be used with unionOfTypes.

    "[IS_OF_TYPE]"?: (value: unknown, field: FieldContext) => boolean

    Type checking function for union type resolution

    Methods

    • Compiles the schema into a literal compiler node

      Parameters

      Returns FieldNode & {} & { subtype: string }

    • Creates a deep copy of the schema instance

      Returns this