UNPKG

valibot-schema-semver

Version:
21 lines (17 loc) 796 B
import { CustomIssue, CustomSchema, ErrorMessage, InferOutput } from 'valibot'; /** * A schema for validating Semantic Versioning {@see {@link https://semver.org/}}. * @module */ /** * Function to validate Semantic Versioning strings. * @param overrideMessage - A string to override the default message or a callback to define a custom message function. * @returns A custom schema for Semantic Versioning validation. */ declare const semver: (overrideMessage?: string | ((value: CustomIssue) => string)) => CustomSchema<string, ErrorMessage<CustomIssue>>; /** * Type for the output of the Semantic Versioning schema. * @typedef {InferOutput<ReturnType<typeof semver>>} SemverSchema */ type SemverSchema = InferOutput<ReturnType<typeof semver>>; export { type SemverSchema, semver };