UNPKG

from-schema

Version:

Infer TypeScript types from JSON schemas

18 lines (16 loc) 622 B
import { SchemaBase } from '../generic'; type StringBase = { readonly type: 'string'; }; type VariableString = StringBase & { readonly format?: 'date' | 'time' | 'date-time' | 'email' | 'hostname' | 'ipv4' | 'ipv6' | 'uri' | 'uri-reference' | 'uuid' | 'uri-template' | 'json-pointer' | 'relative-json-pointer' | 'regex'; readonly minLength?: number; readonly maxLength?: number; readonly pattern?: string; readonly examples?: string[]; }; type ConstantString = StringBase & { readonly const: string; }; export type StringTsonSchema = SchemaBase & (VariableString | ConstantString); export {};