API

Codecs

The codec factories, their shared options, and the types behind them.

Factories

ExportValue typeOptions
stringCodec(options?)stringtrim, minLength, maxLength, pattern
numberCodec(options?)numberint, min, max, outOfRange
booleanCodec(options?)booleannone beyond the shared ones
enumCodec(values, options?)values[number]none beyond the shared ones
dateCodec(options)Dateformat (required), min, max, outOfRange
arrayCodec(item, options?)item[]separator, minItems, maxItems, unique, invalidItems
schemaCodec(schema, options?)the schema's outputformat (URL format, JSON by default), shared ones without validate
defineCodec(format)your typereturns a factory that takes the shared options

Shared options: default, validate, historyMode, omitDefault. See Built-in codecs for each one.

Types

Hover the name for its full signature.

import type { 
ParseResult
,
QueryCodec
,
QueryIssue
} from '@chronicstone/vue-route-query'
TypeDescription
QueryCodec<TValue, TState>What a factory returns: parse, serialize, defaultValue, historyMode, omitDefault. TState is the ref type.
ParseResult<T>{ ok: true; value; issue? } or { ok: false; issue }.
QueryIssue{ reason: 'format' | 'option' | 'validate' | 'group'; message; rule? }.
QueryFormat<T>{ parse, serialize }, the argument of defineCodec.
InferCodecState<C>The ref type a codec produces.
AnyQueryCodecAny codec, for your own helpers and resolve results.
Copyright © 2026 Cyprien Thao. Released under the MIT License.