UNPKG

jsonv-ts

Version:

JSON Schema builder and validator for TypeScript with static type inference, Hono middleware for OpenAPI generation and validation, and MCP server/client implementation. Lightweight, dependency-free, and built on Web Standards.

15 lines (14 loc) 782 B
import { Schema, type ISchemaOptions, type StrictOptions } from "./schema"; import type { Merge } from "../static"; export interface IAnyOptions extends ISchemaOptions { [key: string]: any; } export declare const any: <const O extends IAnyOptions>(o?: O) => Schema<O, any, any> & O; type Primitive = string | number | boolean | null | undefined | bigint; type TLiteralType<T, Excluded extends object> = T extends Primitive ? T : T extends object ? T extends Excluded ? never : T : never; export interface ILiteralOptions extends Omit<ISchemaOptions, "const" | "enum"> { } export declare const literal: <const L, const O extends ILiteralOptions>(value: TLiteralType<L, Schema>, o?: StrictOptions<ILiteralOptions, O>) => Schema<O, L, L> & Merge<O & { const: L; }>; export {};