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.
13 lines (12 loc) • 893 B
TypeScript
import { Schema, type ISchemaOptions } from "../schema/schema";
import type { Static, StaticCoerced } from "../static";
export type TRefType = Schema & {
$id: string;
};
export declare class RefType<const T extends TRefType | unknown | undefined, const Ref extends string | undefined, Out = T extends TRefType ? Static<T> : T, Coerced = T extends TRefType ? StaticCoerced<T> : T> extends Schema<ISchemaOptions, Out, Coerced> {
readonly $ref: Ref;
constructor(ref: T, $ref: Ref);
}
export declare const ref: <const T extends TRefType, const Ref extends string>(ref: T, $ref?: Ref) => RefType<T, Ref, T extends TRefType ? Static<T> : T, T extends TRefType ? StaticCoerced<T> : T>;
export declare const refId: <T = unknown, const Ref extends string = string>($ref: Ref) => RefType<T, Ref>;
export declare const recursive: <const T extends Schema>(cb: (thisSchema: Schema) => T) => T;