UNPKG

@sinclair/typebox

Version:

Json Schema Type Builder with Static Type Resolution for TypeScript

15 lines (14 loc) 768 B
import { TypeBoxError } from '../type/error/index'; export declare class TypeSystemDuplicateTypeKind extends TypeBoxError { constructor(kind: string); } export declare class TypeSystemDuplicateFormat extends TypeBoxError { constructor(kind: string); } /** Creates user defined types and formats and provides overrides for value checking behaviours */ export declare namespace TypeSystem { /** Creates a new type */ function Type<Type, Options = Record<PropertyKey, unknown>>(kind: string, check: (options: Options, value: unknown) => boolean): (options?: Partial<Options>) => import("../type/unsafe/unsafe").TUnsafe<Type>; /** Creates a new string format */ function Format<F extends string>(format: F, check: (value: string) => boolean): F; }