SchemaAST
Annotations
Signature
interface Annotated { readonly annotations: Annotations;}Annotations interface
Signature
interface Annotations { [_: string]: unknown; [_: symbol]: unknown;}ArbitraryAnnotationId
Signature
declare const ArbitraryAnnotationId: unique symbolBatchingAnnotation type
Signature
type BatchingAnnotation = boolean | "inherit" | undefinedBatchingAnnotationId
Signature
declare const BatchingAnnotationId: unique symbolBrandAnnotation type
Signature
type BrandAnnotation = Arr.NonEmptyReadonlyArray<string | symbol>BrandAnnotationId
Signature
declare const BrandAnnotationId: unique symbolConcurrencyAnnotation type
Signature
type ConcurrencyAnnotation = Concurrency | undefinedConcurrencyAnnotationId
Signature
declare const ConcurrencyAnnotationId: unique symbolDecodingFallbackAnnotation type
Signature
type DecodingFallbackAnnotation<A> = (issue: ParseIssue) => Effect<A, ParseIssue>DecodingFallbackAnnotationId
Signature
declare const DecodingFallbackAnnotationId: unique symbolDefaultAnnotation type
Signature
type DefaultAnnotation<A> = ADefaultAnnotationId
Signature
declare const DefaultAnnotationId: unique symbolDescriptionAnnotation type
Signature
type DescriptionAnnotation = stringDescriptionAnnotationId
Signature
declare const DescriptionAnnotationId: unique symbolDocumentationAnnotation type
Signature
type DocumentationAnnotation = stringDocumentationAnnotationId
Signature
declare const DocumentationAnnotationId: unique symbolEquivalenceAnnotation type
Signature
type EquivalenceAnnotation<A, TypeParameters extends ReadonlyArray<any> = readonly []> = (...equivalences: { [K in keyof TypeParameters]: Equivalence<TypeParameters[K]> }) => Equivalence<A>EquivalenceAnnotationId
Signature
declare const EquivalenceAnnotationId: unique symbolExamplesAnnotation type
Signature
type ExamplesAnnotation<A> = Arr.NonEmptyReadonlyArray<A>ExamplesAnnotationId
Signature
declare const ExamplesAnnotationId: unique symbolgetAnnotation
Signature
declare const getAnnotation: { <A>(key: symbol): (annotated: Annotated) => Option<A>; <A>(annotated: Annotated, key: symbol): Option<A>;}getBatchingAnnotation
Signature
declare const getBatchingAnnotation: (annotated: Annotated) => Option<BatchingAnnotation>getBrandAnnotation
Signature
declare const getBrandAnnotation: (annotated: Annotated) => Option<readonly [string | symbol, string | symbol]>getConcurrencyAnnotation
Signature
declare const getConcurrencyAnnotation: (annotated: Annotated) => Option<ConcurrencyAnnotation>getDecodingFallbackAnnotation
Signature
declare const getDecodingFallbackAnnotation: (annotated: Annotated) => Option<DecodingFallbackAnnotation<unknown>>getDefaultAnnotation
Signature
declare const getDefaultAnnotation: (annotated: Annotated) => Option<unknown>getDescriptionAnnotation
Signature
declare const getDescriptionAnnotation: (annotated: Annotated) => Option<string>getDocumentationAnnotation
Signature
declare const getDocumentationAnnotation: (annotated: Annotated) => Option<string>getExamplesAnnotation
Signature
declare const getExamplesAnnotation: (annotated: Annotated) => Option<readonly [unknown, unknown]>getIdentifierAnnotation
Signature
declare const getIdentifierAnnotation: (annotated: Annotated) => Option<string>getJSONIdentifier
Signature
declare function getJSONIdentifier(annotated: Annotated): Option<string>getJSONIdentifierAnnotation
Signature
declare const getJSONIdentifierAnnotation: (annotated: Annotated) => Option<string>getJSONSchemaAnnotation
Signature
declare const getJSONSchemaAnnotation: (annotated: Annotated) => Option<object>getMessageAnnotation
Signature
declare const getMessageAnnotation: (annotated: Annotated) => Option<MessageAnnotation>getMissingMessageAnnotation
Signature
declare const getMissingMessageAnnotation: (annotated: Annotated) => Option<MissingMessageAnnotation>getParseIssueTitleAnnotation
Signature
declare const getParseIssueTitleAnnotation: (annotated: Annotated) => Option<ParseIssueTitleAnnotation>getParseOptionsAnnotation
Signature
declare const getParseOptionsAnnotation: (annotated: Annotated) => Option<ParseOptions>getSchemaIdAnnotation
Signature
declare const getSchemaIdAnnotation: (annotated: Annotated) => Option<SchemaIdAnnotation>getSurrogateAnnotation
Signature
declare const getSurrogateAnnotation: (annotated: Annotated) => Option<AST>getTitleAnnotation
Signature
declare const getTitleAnnotation: (annotated: Annotated) => Option<string>getTypeConstructorAnnotation
Signature
declare const getTypeConstructorAnnotation: (annotated: Annotated) => Option<TypeConstructorAnnotation>IdentifierAnnotation type
Signature
type IdentifierAnnotation = stringIdentifierAnnotationId
Signature
declare const IdentifierAnnotationId: unique symbolJSONIdentifierAnnotationId
Signature
declare const JSONIdentifierAnnotationId: unique symbolJSONSchemaAnnotation type
Signature
type JSONSchemaAnnotation = objectJSONSchemaAnnotationId
Signature
declare const JSONSchemaAnnotationId: unique symbolMessageAnnotation type
Signature
type MessageAnnotation = (issue: ParseIssue) => string | Effect<string> | { readonly message: string | Effect<string>; readonly override: boolean;}MessageAnnotationId
Signature
declare const MessageAnnotationId: unique symbolMissingMessageAnnotation type
Signature
type MissingMessageAnnotation = () => string | Effect<string>MissingMessageAnnotationId
Signature
declare const MissingMessageAnnotationId: unique symbolParseIssueTitleAnnotation type
Signature
type ParseIssueTitleAnnotation = (issue: ParseIssue) => string | undefinedParseIssueTitleAnnotationId
Signature
declare const ParseIssueTitleAnnotationId: unique symbolParseOptionsAnnotationId
Signature
declare const ParseOptionsAnnotationId: unique symbolPrettyAnnotationId
Signature
declare const PrettyAnnotationId: unique symbolSchemaIdAnnotation type
Signature
type SchemaIdAnnotation = string | symbolSchemaIdAnnotationId
Signature
declare const SchemaIdAnnotationId: unique symbolSurrogateAnnotation type
Signature
type SurrogateAnnotation = ASTSurrogateAnnotationId
Signature
declare const SurrogateAnnotationId: unique symbolTitleAnnotation type
Signature
type TitleAnnotation = stringTitleAnnotationId
Signature
declare const TitleAnnotationId: unique symbolTypeConstructorAnnotation type
Signature
type TypeConstructorAnnotation = { [key: string | number | symbol]: unknown; readonly _tag: string;}TypeConstructorAnnotationId
Signature
declare const TypeConstructorAnnotationId: unique symbolConstructors
anyKeyword
Signature
declare const anyKeyword: AnyKeywordbigIntKeyword
Signature
declare const bigIntKeyword: BigIntKeywordbooleanKeyword
Signature
declare const booleanKeyword: BooleanKeywordcomposeTransformation
Signature
declare const composeTransformation: ComposeTransformationneverKeyword
Signature
declare const neverKeyword: NeverKeywordnumberKeyword
Signature
declare const numberKeyword: NumberKeywordobjectKeyword
Signature
declare const objectKeyword: ObjectKeywordstringKeyword
Signature
declare const stringKeyword: StringKeywordsymbolKeyword
Signature
declare const symbolKeyword: SymbolKeywordundefinedKeyword
Signature
declare const undefinedKeyword: UndefinedKeywordunknownKeyword
Signature
declare const unknownKeyword: UnknownKeywordvoidKeyword
Signature
declare const voidKeyword: VoidKeywordGuards
isAnyKeyword
Signature
declare const isAnyKeyword: (ast: AST) => ast is AnyKeywordisBigIntKeyword
Signature
declare const isBigIntKeyword: (ast: AST) => ast is BigIntKeywordisBooleanKeyword
Signature
declare const isBooleanKeyword: (ast: AST) => ast is BooleanKeywordisComposeTransformation
Signature
declare const isComposeTransformation: (ast: TransformationKind) => ast is ComposeTransformationisDeclaration
Signature
declare const isDeclaration: (ast: AST) => ast is DeclarationSignature
declare const isEnums: (ast: AST) => ast is EnumsisFinalTransformation
Signature
declare const isFinalTransformation: (ast: TransformationKind) => ast is FinalTransformationSignature
declare const isLiteral: (ast: AST) => ast is LiteralisNeverKeyword
Signature
declare const isNeverKeyword: (ast: AST) => ast is NeverKeywordisNumberKeyword
Signature
declare const isNumberKeyword: (ast: AST) => ast is NumberKeywordisObjectKeyword
Signature
declare const isObjectKeyword: (ast: AST) => ast is ObjectKeywordisRefinement
Signature
declare const isRefinement: (ast: AST) => ast is Refinement<AST>isStringKeyword
Signature
declare const isStringKeyword: (ast: AST) => ast is StringKeywordSignature
declare const isSuspend: (ast: AST) => ast is SuspendisSymbolKeyword
Signature
declare const isSymbolKeyword: (ast: AST) => ast is SymbolKeywordisTemplateLiteral
Signature
declare const isTemplateLiteral: (ast: AST) => ast is TemplateLiteralisTransformation
Signature
declare const isTransformation: (ast: AST) => ast is TransformationisTupleType
Signature
declare const isTupleType: (ast: AST) => ast is TupleTypeisTypeLiteral
Signature
declare const isTypeLiteral: (ast: AST) => ast is TypeLiteralisTypeLiteralTransformation
Signature
declare const isTypeLiteralTransformation: (ast: TransformationKind) => ast is TypeLiteralTransformationisUndefinedKeyword
Signature
declare const isUndefinedKeyword: (ast: AST) => ast is UndefinedKeywordSignature
declare const isUnion: (ast: AST) => ast is UnionisUniqueSymbol
Signature
declare const isUniqueSymbol: (ast: AST) => ast is UniqueSymbolisUnknownKeyword
Signature
declare const isUnknownKeyword: (ast: AST) => ast is UnknownKeywordisVoidKeyword
Signature
declare const isVoidKeyword: (ast: AST) => ast is VoidKeywordModel
AnyKeyword
Signature
declare class AnyKeyword implements Annotated { constructor(annotations: Annotations); readonly _tag: "AnyKeyword"; readonly annotations: Annotations; toJSON(): object; toString(): string;}Signature
type AST = Declaration | Literal | UniqueSymbol | UndefinedKeyword | VoidKeyword | NeverKeyword | UnknownKeyword | AnyKeyword | StringKeyword | NumberKeyword | BooleanKeyword | BigIntKeyword | SymbolKeyword | ObjectKeyword | Enums | TemplateLiteral | Refinement | TupleType | TypeLiteral | Union | Suspend | TransformationBigIntKeyword
Signature
declare class BigIntKeyword implements Annotated { constructor(annotations: Annotations); readonly _tag: "BigIntKeyword"; readonly annotations: Annotations; toJSON(): object; toString(): string;}BooleanKeyword
Signature
declare class BooleanKeyword implements Annotated { constructor(annotations: Annotations); readonly _tag: "BooleanKeyword"; readonly annotations: Annotations; toJSON(): object; toString(): string;}ComposeTransformation
Signature
declare class ComposeTransformation { constructor(); readonly _tag: "ComposeTransformation";}Declaration
Signature
declare class Declaration implements Annotated { constructor(typeParameters: readonly Array<AST>, decodeUnknown: (...typeParameters: readonly Array<AST>) => (input: unknown, options: ParseOptions, self: Declaration) => Effect<any, ParseIssue, any>, encodeUnknown: (...typeParameters: readonly Array<AST>) => (input: unknown, options: ParseOptions, self: Declaration) => Effect<any, ParseIssue, any>, annotations: Annotations); readonly _tag: "Declaration"; readonly annotations: Annotations; readonly decodeUnknown: (...typeParameters: readonly Array<AST>) => (input: unknown, options: ParseOptions, self: Declaration) => Effect<any, ParseIssue, any>; readonly encodeUnknown: (...typeParameters: readonly Array<AST>) => (input: unknown, options: ParseOptions, self: Declaration) => Effect<any, ParseIssue, any>; readonly typeParameters: readonly Array<AST>; toJSON(): object; toString(): string;}Signature
declare class Enums implements Annotated { constructor(enums: readonly Array<readonly [string, string | number]>, annotations: Annotations); readonly _tag: "Enums"; readonly annotations: Annotations; readonly enums: readonly Array<readonly [string, string | number]>; toJSON(): object; toString(): string;}FinalTransformation
Signature
declare class FinalTransformation { constructor(decode: (fromA: any, options: ParseOptions, self: Transformation, fromI: any) => Effect<any, ParseIssue, any>, encode: (toI: any, options: ParseOptions, self: Transformation, toA: any) => Effect<any, ParseIssue, any>); readonly _tag: "FinalTransformation"; readonly decode: (fromA: any, options: ParseOptions, self: Transformation, fromI: any) => Effect<any, ParseIssue, any>; readonly encode: (toI: any, options: ParseOptions, self: Transformation, toA: any) => Effect<any, ParseIssue, any>;}IndexSignature
Signature
declare class IndexSignature { constructor(parameter: AST, type: AST, isReadonly: boolean); readonly isReadonly: boolean; readonly parameter: Parameter; readonly type: AST; toJSON(): object; toString(): string;}Signature
declare class Literal implements Annotated { constructor(literal: LiteralValue, annotations: Annotations); readonly _tag: "Literal"; readonly annotations: Annotations; readonly literal: LiteralValue; toJSON(): object; toString(): string;}LiteralValue type
Signature
type LiteralValue = string | number | boolean | null | bigintNeverKeyword
Signature
declare class NeverKeyword implements Annotated { constructor(annotations: Annotations); readonly _tag: "NeverKeyword"; readonly annotations: Annotations; toJSON(): object; toString(): string;}NumberKeyword
Signature
declare class NumberKeyword implements Annotated { constructor(annotations: Annotations); readonly _tag: "NumberKeyword"; readonly annotations: Annotations; toJSON(): object; toString(): string;}ObjectKeyword
Signature
declare class ObjectKeyword implements Annotated { constructor(annotations: Annotations); readonly _tag: "ObjectKeyword"; readonly annotations: Annotations; toJSON(): object; toString(): string;}OptionalType
Signature
declare class OptionalType extends Type { constructor(type: AST, isOptional: boolean, annotations: Annotations); readonly isOptional: boolean; toJSON(): object; toString(): string;}ParseOptions interface
Signature
interface ParseOptions { readonly errors?: "first" | "all"; readonly exact?: boolean; readonly onExcessProperty?: "error" | "ignore" | "preserve"; readonly propertyOrder?: "none" | "original";}PropertySignature
Signature
declare class PropertySignature extends OptionalType { constructor(name: PropertyKey, type: AST, isOptional: boolean, isReadonly: boolean, annotations?: Annotations); readonly isReadonly: boolean; readonly name: PropertyKey; toJSON(): object; toString(): string;}PropertySignatureTransformation
Represents a PropertySignature -> PropertySignature transformation
The semantic of decode is:
none()represents the absence of the key/value pairsome(value)represents the presence of the key/value pair
The semantic of encode is:
none()you don't want to output the key/value pairsome(value)you want to output the key/value pair
Signature
declare class PropertySignatureTransformation { constructor(from: PropertyKey, to: PropertyKey, decode: (o: Option<any>) => Option<any>, encode: (o: Option<any>) => Option<any>); readonly decode: (o: Option<any>) => Option<any>; readonly encode: (o: Option<any>) => Option<any>; readonly from: PropertyKey; readonly to: PropertyKey;}Refinement
Signature
declare class Refinement<From extends AST = AST> implements Annotated { constructor<From extends AST = AST>(from: From, filter: (input: any, options: ParseOptions, self: Refinement) => Option<ParseIssue>, annotations: Annotations); readonly _tag: "Refinement"; readonly annotations: Annotations; readonly filter: (input: any, options: ParseOptions, self: Refinement) => Option<ParseIssue>; readonly from: From; toJSON(): object; toString(): string;}StringKeyword
Signature
declare class StringKeyword implements Annotated { constructor(annotations: Annotations); readonly _tag: "StringKeyword"; readonly annotations: Annotations; toJSON(): object; toString(): string;}Signature
declare class Suspend implements Annotated { constructor(f: () => AST, annotations: Annotations); readonly _tag: "Suspend"; readonly annotations: Annotations; readonly f: () => AST; toJSON(): object; toString(): string;}SymbolKeyword
Signature
declare class SymbolKeyword implements Annotated { constructor(annotations: Annotations); readonly _tag: "SymbolKeyword"; readonly annotations: Annotations; toJSON(): object; toString(): string;}TemplateLiteral
Signature
declare class TemplateLiteral implements Annotated { constructor(head: string, spans: readonly [TemplateLiteralSpan, TemplateLiteralSpan], annotations: Annotations); readonly _tag: "TemplateLiteral"; readonly annotations: Annotations; readonly head: string; readonly spans: readonly [TemplateLiteralSpan, TemplateLiteralSpan]; toJSON(): object; toString(): string;}TemplateLiteralSpan
Signature
declare class TemplateLiteralSpan { constructor(type: AST, literal: string); readonly literal: string; readonly type: TemplateLiteralSpanType; toJSON(): object; toString(): string;}Transformation
Signature
declare class Transformation implements Annotated { constructor(from: AST, to: AST, transformation: TransformationKind, annotations: Annotations); readonly _tag: "Transformation"; readonly annotations: Annotations; readonly from: AST; readonly to: AST; readonly transformation: TransformationKind; toJSON(): object; toString(): string;}TransformationKind type
Signature
type TransformationKind = FinalTransformation | ComposeTransformation | TypeLiteralTransformationSignature
declare class TupleType implements Annotated { constructor(elements: readonly Array<OptionalType>, rest: readonly Array<Type>, isReadonly: boolean, annotations: Annotations); readonly _tag: "TupleType"; readonly annotations: Annotations; readonly elements: readonly Array<OptionalType>; readonly isReadonly: boolean; readonly rest: readonly Array<Type>; toJSON(): object; toString(): string;}Signature
declare class Type implements Annotated { constructor(type: AST, annotations: Annotations); readonly annotations: Annotations; readonly type: AST; toJSON(): object; toString(): string;}TypeLiteral
Signature
declare class TypeLiteral implements Annotated { constructor(propertySignatures: readonly Array<PropertySignature>, indexSignatures: readonly Array<IndexSignature>, annotations: Annotations); readonly _tag: "TypeLiteral"; readonly annotations: Annotations; readonly indexSignatures: readonly Array<IndexSignature>; readonly propertySignatures: readonly Array<PropertySignature>; toJSON(): object; toString(): string;}TypeLiteralTransformation
Signature
declare class TypeLiteralTransformation { constructor(propertySignatureTransformations: readonly Array<PropertySignatureTransformation>); readonly _tag: "TypeLiteralTransformation"; readonly propertySignatureTransformations: readonly Array<PropertySignatureTransformation>;}UndefinedKeyword
Signature
declare class UndefinedKeyword implements Annotated { constructor(annotations: Annotations); readonly _tag: "UndefinedKeyword"; readonly annotations: Annotations; toJSON(): object; toString(): string;}Signature
declare class Union<M extends AST = AST> implements Annotated { readonly _tag: "Union"; readonly annotations: Annotations; readonly types: readonly [M, M, M]; toJSON(): object; toString(): string; static make(types: readonly Array<AST>, annotations?: Annotations): AST;}UniqueSymbol
Signature
declare class UniqueSymbol implements Annotated { constructor(symbol: symbol, annotations: Annotations); readonly _tag: "UniqueSymbol"; readonly annotations: Annotations; readonly symbol: symbol; toJSON(): object; toString(): string;}UnknownKeyword
Signature
declare class UnknownKeyword implements Annotated { constructor(annotations: Annotations); readonly _tag: "UnknownKeyword"; readonly annotations: Annotations; toJSON(): object; toString(): string;}VoidKeyword
Signature
declare class VoidKeyword implements Annotated { constructor(annotations: Annotations); readonly _tag: "VoidKeyword"; readonly annotations: Annotations; toJSON(): object; toString(): string;}Other
annotations
Merges a set of new annotations with existing ones, potentially overwriting any duplicates.
Any previously existing identifier annotations are deleted.
Signature
declare function annotations(ast: AST, overrides: Annotations): ASTSignature
type Compiler<A> = (ast: AST, path: ReadonlyArray<PropertyKey>) => AdefaultParseOption
Signature
declare const defaultParseOption: ParseOptionsencodedAST
Signature
declare function encodedAST(ast: AST): ASTencodedBoundAST
Signature
declare function encodedBoundAST(ast: AST): ASTgetCompiler
Signature
declare function getCompiler<A>(match: Match<A>): Compiler<A>getPropertySignatures
Signature
declare function getPropertySignatures(ast: AST): Array<PropertySignature>getTemplateLiteralCapturingRegExp
Generates a regular expression that captures the pattern defined by the given TemplateLiteral AST.
See
- getTemplateLiteralRegExp for a variant that does not capture the pattern.
Signature
declare function getTemplateLiteralCapturingRegExp(ast: TemplateLiteral): RegExpgetTemplateLiteralRegExp
Generates a regular expression from a TemplateLiteral AST node.
See
- getTemplateLiteralCapturingRegExp for a variant that captures the pattern.
Signature
declare function getTemplateLiteralRegExp(ast: TemplateLiteral): RegExpisParameter
Signature
declare function isParameter(ast: AST): ast is ParameterEquivalent at runtime to the TypeScript type-level keyof operator.
Signature
declare function keyof(ast: AST): ASTSignature
type Match<A> = { [K in AST["_tag"]]: (ast: Extract<AST, { _tag: K;}>, compile: Compiler<A>, path: ReadonlyArray<PropertyKey>) => A }Signature
type Members<A> = readonly [A, A, ...Array<A>]Creates a new AST with shallow mutability applied to its properties.
Signature
declare function mutable(ast: AST): ASTSignature
declare const null: LiteralEquivalent at runtime to the built-in TypeScript utility type Omit.
Signature
declare function omit(ast: AST, keys: readonly Array<PropertyKey>): TypeLiteral | TransformationSignature
type Parameter = StringKeyword | SymbolKeyword | TemplateLiteral | Refinement<Parameter>Equivalent at runtime to the built-in TypeScript utility type Partial.
Signature
declare function partial(ast: AST, options?: { readonly exact: true;}): ASTEquivalent at runtime to the built-in TypeScript utility type Pick.
Signature
declare function pick(ast: AST, keys: readonly Array<PropertyKey>): TypeLiteral | TransformationEquivalent at runtime to the built-in TypeScript utility type Required.
Signature
declare function required(ast: AST): ASTSignature
declare function typeAST(ast: AST): ASTSchema Id
ParseJsonSchemaId
Signature
declare const ParseJsonSchemaId: unique symbol