valibot-schema-ksuid
Version:
Valibot schema for K-Sortable Unique IDentifiers (KSUID)
21 lines (17 loc) • 767 B
TypeScript
import { CustomIssue, CustomSchema, ErrorMessage, InferOutput } from 'valibot';
/**
* A schema for validating r K-Sortable Unique IDentifiers {@see {@link https://github.com/segmentio/ksuid}}.
* @module
*/
/**
* Function to validate KSUIDs.
* @param overrideMessage - A string to override the default message or a callback to define a custom message function.
* @returns A custom schema for KSUID validation.
*/
declare const ksuid: (overrideMessage?: string | ((value: CustomIssue) => string)) => CustomSchema<string, ErrorMessage<CustomIssue>>;
/**
* Type for the output of the KSUID schema.
* @typedef {InferOutput<ReturnType<typeof ksuid>>} KsuidSchema
*/
type KsuidSchema = InferOutput<ReturnType<typeof ksuid>>;
export { type KsuidSchema, ksuid };