SchemaAST.ts overview
Since v3.10.0
Exports Grouped by Category
- annotations
- Annotated (interface)
- Annotations (interface)
- ArbitraryAnnotationId
- BatchingAnnotation (type alias)
- BatchingAnnotationId
- BrandAnnotation (type alias)
- BrandAnnotationId
- ConcurrencyAnnotation (type alias)
- ConcurrencyAnnotationId
- DecodingFallbackAnnotation (type alias)
- DecodingFallbackAnnotationId
- DefaultAnnotation (type alias)
- DefaultAnnotationId
- DescriptionAnnotation (type alias)
- DescriptionAnnotationId
- DocumentationAnnotation (type alias)
- DocumentationAnnotationId
- EquivalenceAnnotation (type alias)
- EquivalenceAnnotationId
- ExamplesAnnotation (type alias)
- ExamplesAnnotationId
- IdentifierAnnotation (type alias)
- IdentifierAnnotationId
- JSONIdentifierAnnotationId
- JSONSchemaAnnotation (type alias)
- JSONSchemaAnnotationId
- MessageAnnotation (type alias)
- MessageAnnotationId
- MissingMessageAnnotation (type alias)
- MissingMessageAnnotationId
- ParseIssueTitleAnnotation (type alias)
- ParseIssueTitleAnnotationId
- ParseOptionsAnnotationId
- PrettyAnnotationId
- SchemaIdAnnotation (type alias)
- SchemaIdAnnotationId
- SurrogateAnnotation (type alias)
- SurrogateAnnotationId
- TitleAnnotation (type alias)
- TitleAnnotationId
- getAnnotation
- getBatchingAnnotation
- getBrandAnnotation
- getConcurrencyAnnotation
- getDecodingFallbackAnnotation
- getDefaultAnnotation
- getDescriptionAnnotation
- getDocumentationAnnotation
- getExamplesAnnotation
- getIdentifierAnnotation
- getJSONIdentifier
- getJSONIdentifierAnnotation
- getJSONSchemaAnnotation
- getMessageAnnotation
- getMissingMessageAnnotation
- getParseIssueTitleAnnotation
- getParseOptionsAnnotation
- getSchemaIdAnnotation
- getSurrogateAnnotation
- getTitleAnnotation
- constructors
- guards
- isAnyKeyword
- isBigIntKeyword
- isBooleanKeyword
- isComposeTransformation
- isDeclaration
- isEnums
- isFinalTransformation
- isLiteral
- isNeverKeyword
- isNumberKeyword
- isObjectKeyword
- isRefinement
- isStringKeyword
- isSuspend
- isSymbolKeyword
- isTemplateLiteral
- isTransformation
- isTupleType
- isTypeLiteral
- isTypeLiteralTransformation
- isUndefinedKeyword
- isUnion
- isUniqueSymbol
- isUnknownKeyword
- isVoidKeyword
- model
- AST (type alias)
- AnyKeyword (class)
- BigIntKeyword (class)
- BooleanKeyword (class)
- ComposeTransformation (class)
- Declaration (class)
- Enums (class)
- FinalTransformation (class)
- IndexSignature (class)
- Literal (class)
- LiteralValue (type alias)
- NeverKeyword (class)
- NumberKeyword (class)
- ObjectKeyword (class)
- OptionalType (class)
- ParseOptions (interface)
- PropertySignature (class)
- PropertySignatureTransformation (class)
- Refinement (class)
- StringKeyword (class)
- Suspend (class)
- SymbolKeyword (class)
- TemplateLiteral (class)
- TemplateLiteralSpan (class)
- Transformation (class)
- TransformationKind (type alias)
- TupleType (class)
- Type (class)
- TypeLiteral (class)
- TypeLiteralTransformation (class)
- UndefinedKeyword (class)
- Union (class)
- UniqueSymbol (class)
- UnknownKeyword (class)
- VoidKeyword (class)
- schema id
- utils
annotations
Annotated (interface)
Signature
export interface Annotated {
readonly annotations: Annotations
}
Since v3.10.0
Annotations (interface)
Signature
export interface Annotations {
readonly [_: string]: unknown
readonly [_: symbol]: unknown
}
Since v3.10.0
ArbitraryAnnotationId
Signature
declare const ArbitraryAnnotationId: unique symbol
Since v3.10.0
BatchingAnnotation (type alias)
Signature
type BatchingAnnotation = boolean | "inherit" | undefined
Since v3.10.0
BatchingAnnotationId
Signature
declare const BatchingAnnotationId: unique symbol
Since v3.10.0
BrandAnnotation (type alias)
Signature
type BrandAnnotation = Arr.NonEmptyReadonlyArray<string | symbol>
Since v3.10.0
BrandAnnotationId
Signature
declare const BrandAnnotationId: unique symbol
Since v3.10.0
ConcurrencyAnnotation (type alias)
Signature
type ConcurrencyAnnotation = Concurrency | undefined
Since v3.10.0
ConcurrencyAnnotationId
Signature
declare const ConcurrencyAnnotationId: unique symbol
Since v3.10.0
DecodingFallbackAnnotation (type alias)
Signature
type DecodingFallbackAnnotation<A> = (issue: ParseIssue) => Effect<A, ParseIssue>
Since v3.10.0
DecodingFallbackAnnotationId
Signature
declare const DecodingFallbackAnnotationId: unique symbol
Since v3.10.0
DefaultAnnotation (type alias)
Signature
type A = A
Since v3.10.0
DefaultAnnotationId
Signature
declare const DefaultAnnotationId: unique symbol
Since v3.10.0
DescriptionAnnotation (type alias)
Signature
type DescriptionAnnotation = string
Since v3.10.0
DescriptionAnnotationId
Signature
declare const DescriptionAnnotationId: unique symbol
Since v3.10.0
DocumentationAnnotation (type alias)
Signature
type DocumentationAnnotation = string
Since v3.10.0
DocumentationAnnotationId
Signature
declare const DocumentationAnnotationId: unique symbol
Since v3.10.0
EquivalenceAnnotation (type alias)
Signature
type EquivalenceAnnotation<A, TypeParameters> = (
...equivalences: { readonly [K in keyof TypeParameters]: Equivalence<TypeParameters[K]> }
) => Equivalence<A>
Since v3.10.0
EquivalenceAnnotationId
Signature
declare const EquivalenceAnnotationId: unique symbol
Since v3.10.0
ExamplesAnnotation (type alias)
Signature
type readonly [A, ...A[]] = Arr.NonEmptyReadonlyArray<A>
Since v3.10.0
ExamplesAnnotationId
Signature
declare const ExamplesAnnotationId: unique symbol
Since v3.10.0
IdentifierAnnotation (type alias)
Signature
type IdentifierAnnotation = string
Since v3.10.0
IdentifierAnnotationId
Signature
declare const IdentifierAnnotationId: unique symbol
Since v3.10.0
JSONIdentifierAnnotationId
Signature
declare const JSONIdentifierAnnotationId: unique symbol
Since v3.10.0
JSONSchemaAnnotation (type alias)
Signature
type JSONSchemaAnnotation = object
Since v3.10.0
JSONSchemaAnnotationId
Signature
declare const JSONSchemaAnnotationId: unique symbol
Since v3.10.0
MessageAnnotation (type alias)
Signature
type MessageAnnotation = (issue: ParseIssue) =>
| string
| Effect<string>
| {
readonly message: string | Effect<string>
readonly override: boolean
}
Since v3.10.0
MessageAnnotationId
Signature
declare const MessageAnnotationId: unique symbol
Since v3.10.0
MissingMessageAnnotation (type alias)
Signature
type MissingMessageAnnotation = () => string | Effect<string>
Since v3.10.0
MissingMessageAnnotationId
Signature
declare const MissingMessageAnnotationId: unique symbol
Since v3.10.0
ParseIssueTitleAnnotation (type alias)
Signature
type ParseIssueTitleAnnotation = (issue: ParseIssue) => string | undefined
Since v3.10.0
ParseIssueTitleAnnotationId
Signature
declare const ParseIssueTitleAnnotationId: unique symbol
Since v3.10.0
ParseOptionsAnnotationId
Signature
declare const ParseOptionsAnnotationId: unique symbol
Since v3.10.0
PrettyAnnotationId
Signature
declare const PrettyAnnotationId: unique symbol
Since v3.10.0
SchemaIdAnnotation (type alias)
Signature
type SchemaIdAnnotation = string | symbol
Since v3.10.0
SchemaIdAnnotationId
Signature
declare const SchemaIdAnnotationId: unique symbol
Since v3.10.0
SurrogateAnnotation (type alias)
Signature
type SurrogateAnnotation = AST
Since v3.10.0
SurrogateAnnotationId
Signature
declare const SurrogateAnnotationId: unique symbol
Since v3.10.0
TitleAnnotation (type alias)
Signature
type TitleAnnotation = string
Since v3.10.0
TitleAnnotationId
Signature
declare const TitleAnnotationId: unique symbol
Since v3.10.0
getAnnotation
Signature
declare const getAnnotation: {
<A>(key: symbol): (annotated: Annotated) => Option.Option<A>
<A>(annotated: Annotated, key: symbol): Option.Option<A>
}
Since v3.10.0
getBatchingAnnotation
Signature
declare const getBatchingAnnotation: (annotated: Annotated) => Option.Option<BatchingAnnotation>
Since v3.10.0
getBrandAnnotation
Signature
declare const getBrandAnnotation: (
annotated: Annotated
) => Option.Option<readonly [string | symbol, ...(string | symbol)[]]>
Since v3.10.0
getConcurrencyAnnotation
Signature
declare const getConcurrencyAnnotation: (annotated: Annotated) => Option.Option<ConcurrencyAnnotation>
Since v3.10.0
getDecodingFallbackAnnotation
Signature
declare const getDecodingFallbackAnnotation: (
annotated: Annotated
) => Option.Option<DecodingFallbackAnnotation<unknown>>
Since v3.10.0
getDefaultAnnotation
Signature
declare const getDefaultAnnotation: (annotated: Annotated) => Option.Option<unknown>
Since v3.10.0
getDescriptionAnnotation
Signature
declare const getDescriptionAnnotation: (annotated: Annotated) => Option.Option<string>
Since v3.10.0
getDocumentationAnnotation
Signature
declare const getDocumentationAnnotation: (annotated: Annotated) => Option.Option<string>
Since v3.10.0
getExamplesAnnotation
Signature
declare const getExamplesAnnotation: (annotated: Annotated) => Option.Option<readonly [unknown, ...unknown[]]>
Since v3.10.0
getIdentifierAnnotation
Signature
declare const getIdentifierAnnotation: (annotated: Annotated) => Option.Option<string>
Since v3.10.0
getJSONIdentifier
Signature
declare const getJSONIdentifier: (annotated: Annotated) => Option.Option<string>
Since v3.10.0
getJSONIdentifierAnnotation
Signature
declare const getJSONIdentifierAnnotation: (annotated: Annotated) => Option.Option<string>
Since v3.10.0
getJSONSchemaAnnotation
Signature
declare const getJSONSchemaAnnotation: (annotated: Annotated) => Option.Option<object>
Since v3.10.0
getMessageAnnotation
Signature
declare const getMessageAnnotation: (annotated: Annotated) => Option.Option<MessageAnnotation>
Since v3.10.0
getMissingMessageAnnotation
Signature
declare const getMissingMessageAnnotation: (annotated: Annotated) => Option.Option<MissingMessageAnnotation>
Since v3.10.0
getParseIssueTitleAnnotation
Signature
declare const getParseIssueTitleAnnotation: (annotated: Annotated) => Option.Option<ParseIssueTitleAnnotation>
Since v3.10.0
getParseOptionsAnnotation
Signature
declare const getParseOptionsAnnotation: (annotated: Annotated) => Option.Option<ParseOptions>
Since v3.10.0
getSchemaIdAnnotation
Signature
declare const getSchemaIdAnnotation: (annotated: Annotated) => Option.Option<SchemaIdAnnotation>
Since v3.14.2
getSurrogateAnnotation
Signature
declare const getSurrogateAnnotation: (annotated: Annotated) => Option.Option<AST>
Since v3.10.0
getTitleAnnotation
Signature
declare const getTitleAnnotation: (annotated: Annotated) => Option.Option<string>
Since v3.10.0
constructors
anyKeyword
Signature
declare const anyKeyword: AnyKeyword
Since v3.10.0
bigIntKeyword
Signature
declare const bigIntKeyword: BigIntKeyword
Since v3.10.0
booleanKeyword
Signature
declare const booleanKeyword: BooleanKeyword
Since v3.10.0
composeTransformation
Signature
declare const composeTransformation: ComposeTransformation
Since v3.10.0
neverKeyword
Signature
declare const neverKeyword: NeverKeyword
Since v3.10.0
null
Signature
declare const null: Literal
Since v3.10.0
numberKeyword
Signature
declare const numberKeyword: NumberKeyword
Since v3.10.0
objectKeyword
Signature
declare const objectKeyword: ObjectKeyword
Since v3.10.0
stringKeyword
Signature
declare const stringKeyword: StringKeyword
Since v3.10.0
symbolKeyword
Signature
declare const symbolKeyword: SymbolKeyword
Since v3.10.0
undefinedKeyword
Signature
declare const undefinedKeyword: UndefinedKeyword
Since v3.10.0
unknownKeyword
Signature
declare const unknownKeyword: UnknownKeyword
Since v3.10.0
voidKeyword
Signature
declare const voidKeyword: VoidKeyword
Since v3.10.0
guards
isAnyKeyword
Signature
declare const isAnyKeyword: (ast: AST) => ast is AnyKeyword
Since v3.10.0
isBigIntKeyword
Signature
declare const isBigIntKeyword: (ast: AST) => ast is BigIntKeyword
Since v3.10.0
isBooleanKeyword
Signature
declare const isBooleanKeyword: (ast: AST) => ast is BooleanKeyword
Since v3.10.0
isComposeTransformation
Signature
declare const isComposeTransformation: (ast: TransformationKind) => ast is ComposeTransformation
Since v3.10.0
isDeclaration
Signature
declare const isDeclaration: (ast: AST) => ast is Declaration
Since v3.10.0
isEnums
Signature
declare const isEnums: (ast: AST) => ast is Enums
Since v3.10.0
isFinalTransformation
Signature
declare const isFinalTransformation: (ast: TransformationKind) => ast is FinalTransformation
Since v3.10.0
isLiteral
Signature
declare const isLiteral: (ast: AST) => ast is Literal
Since v3.10.0
isNeverKeyword
Signature
declare const isNeverKeyword: (ast: AST) => ast is NeverKeyword
Since v3.10.0
isNumberKeyword
Signature
declare const isNumberKeyword: (ast: AST) => ast is NumberKeyword
Since v3.10.0
isObjectKeyword
Signature
declare const isObjectKeyword: (ast: AST) => ast is ObjectKeyword
Since v3.10.0
isRefinement
Signature
declare const isRefinement: (ast: AST) => ast is Refinement<AST>
Since v3.10.0
isStringKeyword
Signature
declare const isStringKeyword: (ast: AST) => ast is StringKeyword
Since v3.10.0
isSuspend
Signature
declare const isSuspend: (ast: AST) => ast is Suspend
Since v3.10.0
isSymbolKeyword
Signature
declare const isSymbolKeyword: (ast: AST) => ast is SymbolKeyword
Since v3.10.0
isTemplateLiteral
Signature
declare const isTemplateLiteral: (ast: AST) => ast is TemplateLiteral
Since v3.10.0
isTransformation
Signature
declare const isTransformation: (ast: AST) => ast is Transformation
Since v3.10.0
isTupleType
Signature
declare const isTupleType: (ast: AST) => ast is TupleType
Since v3.10.0
isTypeLiteral
Signature
declare const isTypeLiteral: (ast: AST) => ast is TypeLiteral
Since v3.10.0
isTypeLiteralTransformation
Signature
declare const isTypeLiteralTransformation: (ast: TransformationKind) => ast is TypeLiteralTransformation
Since v3.10.0
isUndefinedKeyword
Signature
declare const isUndefinedKeyword: (ast: AST) => ast is UndefinedKeyword
Since v3.10.0
isUnion
Signature
declare const isUnion: (ast: AST) => ast is Union
Since v3.10.0
isUniqueSymbol
Signature
declare const isUniqueSymbol: (ast: AST) => ast is UniqueSymbol
Since v3.10.0
isUnknownKeyword
Signature
declare const isUnknownKeyword: (ast: AST) => ast is UnknownKeyword
Since v3.10.0
isVoidKeyword
Signature
declare const isVoidKeyword: (ast: AST) => ast is VoidKeyword
Since v3.10.0
model
AST (type alias)
Signature
type AST =
| Declaration
| Literal
| UniqueSymbol
| UndefinedKeyword
| VoidKeyword
| NeverKeyword
| UnknownKeyword
| AnyKeyword
| StringKeyword
| NumberKeyword
| BooleanKeyword
| BigIntKeyword
| SymbolKeyword
| ObjectKeyword
| Enums
| TemplateLiteral
// possible transformations
| Refinement
| TupleType
| TypeLiteral
| Union
| Suspend
// transformations
| Transformation
Since v3.10.0
AnyKeyword (class)
Signature
declare class AnyKeyword { constructor(readonly annotations: Annotations = {}) }
Since v3.10.0
toString (method)
Signature
declare const toString: () => string
Since v3.10.0
toJSON (method)
Signature
declare const toJSON: () => object
Since v3.10.0
_tag (property)
Signature
readonly _tag: "AnyKeyword"
Since v3.10.0
BigIntKeyword (class)
Signature
declare class BigIntKeyword { constructor(readonly annotations: Annotations = {}) }
Since v3.10.0
toString (method)
Signature
declare const toString: () => string
Since v3.10.0
toJSON (method)
Signature
declare const toJSON: () => object
Since v3.10.0
_tag (property)
Signature
readonly _tag: "BigIntKeyword"
Since v3.10.0
BooleanKeyword (class)
Signature
declare class BooleanKeyword { constructor(readonly annotations: Annotations = {}) }
Since v3.10.0
toString (method)
Signature
declare const toString: () => string
Since v3.10.0
toJSON (method)
Signature
declare const toJSON: () => object
Since v3.10.0
_tag (property)
Signature
readonly _tag: "BooleanKeyword"
Since v3.10.0
ComposeTransformation (class)
Signature
declare class ComposeTransformation
Since v3.10.0
_tag (property)
Signature
readonly _tag: "ComposeTransformation"
Since v3.10.0
Declaration (class)
Signature
declare class Declaration { constructor(
readonly typeParameters: ReadonlyArray<AST>,
readonly decodeUnknown: (
...typeParameters: ReadonlyArray<AST>
) => (input: unknown, options: ParseOptions, self: Declaration) => Effect<any, ParseIssue, any>,
readonly encodeUnknown: (
...typeParameters: ReadonlyArray<AST>
) => (input: unknown, options: ParseOptions, self: Declaration) => Effect<any, ParseIssue, any>,
readonly annotations: Annotations = {}
) }
Since v3.10.0
toString (method)
Signature
declare const toString: () => string
Since v3.10.0
toJSON (method)
Signature
declare const toJSON: () => object
Since v3.10.0
_tag (property)
Signature
readonly _tag: "Declaration"
Since v3.10.0
Enums (class)
Signature
declare class Enums { constructor(
readonly enums: ReadonlyArray<readonly [string, string | number]>,
readonly annotations: Annotations = {}
) }
Since v3.10.0
toString (method)
Signature
declare const toString: () => string
Since v3.10.0
toJSON (method)
Signature
declare const toJSON: () => object
Since v3.10.0
_tag (property)
Signature
readonly _tag: "Enums"
Since v3.10.0
FinalTransformation (class)
Signature
declare class FinalTransformation { constructor(
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>
) }
Since v3.10.0
_tag (property)
Signature
readonly _tag: "FinalTransformation"
Since v3.10.0
IndexSignature (class)
Signature
declare class IndexSignature { constructor(
parameter: AST,
readonly type: AST,
readonly isReadonly: boolean
) }
Since v3.10.0
toString (method)
Signature
declare const toString: () => string
Since v3.10.0
toJSON (method)
Signature
declare const toJSON: () => object
Since v3.10.0
parameter (property)
Signature
readonly parameter: Parameter
Since v3.10.0
Literal (class)
Signature
declare class Literal { constructor(readonly literal: LiteralValue, readonly annotations: Annotations = {}) }
Since v3.10.0
toString (method)
Signature
declare const toString: () => string
Since v3.10.0
toJSON (method)
Signature
declare const toJSON: () => object
Since v3.10.0
_tag (property)
Signature
readonly _tag: "Literal"
Since v3.10.0
LiteralValue (type alias)
Signature
type LiteralValue = string | number | boolean | null | bigint
Since v3.10.0
NeverKeyword (class)
Signature
declare class NeverKeyword { constructor(readonly annotations: Annotations = {}) }
Since v3.10.0
toString (method)
Signature
declare const toString: () => string
Since v3.10.0
toJSON (method)
Signature
declare const toJSON: () => object
Since v3.10.0
_tag (property)
Signature
readonly _tag: "NeverKeyword"
Since v3.10.0
NumberKeyword (class)
Signature
declare class NumberKeyword { constructor(readonly annotations: Annotations = {}) }
Since v3.10.0
toString (method)
Signature
declare const toString: () => string
Since v3.10.0
toJSON (method)
Signature
declare const toJSON: () => object
Since v3.10.0
_tag (property)
Signature
readonly _tag: "NumberKeyword"
Since v3.10.0
ObjectKeyword (class)
Signature
declare class ObjectKeyword { constructor(readonly annotations: Annotations = {}) }
Since v3.10.0
toString (method)
Signature
declare const toString: () => string
Since v3.10.0
toJSON (method)
Signature
declare const toJSON: () => object
Since v3.10.0
_tag (property)
Signature
readonly _tag: "ObjectKeyword"
Since v3.10.0
OptionalType (class)
Signature
declare class OptionalType { constructor(
type: AST,
readonly isOptional: boolean,
annotations: Annotations = {}
) }
Since v3.10.0
toJSON (method)
Signature
declare const toJSON: () => object
Since v3.10.0
toString (method)
Signature
declare const toString: () => string
Since v3.10.0
ParseOptions (interface)
Signature
export interface ParseOptions {
/**
* The `errors` option allows you to receive all parsing errors when
* attempting to parse a value using a schema. By default only the first error
* is returned, but by setting the `errors` option to `"all"`, you can receive
* all errors that occurred during the parsing process. This can be useful for
* debugging or for providing more comprehensive error messages to the user.
*
* default: "first"
*
* @since 3.10.0
*/
readonly errors?: "first" | "all" | undefined
/**
* When using a `Schema` to parse a value, by default any properties that are
* not specified in the `Schema` will be stripped out from the output. This is
* because the `Schema` is expecting a specific shape for the parsed value,
* and any excess properties do not conform to that shape.
*
* However, you can use the `onExcessProperty` option (default value:
* `"ignore"`) to trigger a parsing error. This can be particularly useful in
* cases where you need to detect and handle potential errors or unexpected
* values.
*
* If you want to allow excess properties to remain, you can use
* `onExcessProperty` set to `"preserve"`.
*
* default: "ignore"
*
* @since 3.10.0
*/
readonly onExcessProperty?: "ignore" | "error" | "preserve" | undefined
/**
* The `propertyOrder` option provides control over the order of object fields
* in the output. This feature is particularly useful when the sequence of
* keys is important for the consuming processes or when maintaining the input
* order enhances readability and usability.
*
* By default, the `propertyOrder` option is set to `"none"`. This means that
* the internal system decides the order of keys to optimize parsing speed.
* The order of keys in this mode should not be considered stable, and it's
* recommended not to rely on key ordering as it may change in future updates
* without notice.
*
* Setting `propertyOrder` to `"original"` ensures that the keys are ordered
* as they appear in the input during the decoding/encoding process.
*
* default: "none"
*
* @since 3.10.0
*/
readonly propertyOrder?: "none" | "original" | undefined
/**
* Handles missing properties in data structures. By default, missing
* properties are treated as if present with an `undefined` value. To treat
* missing properties as errors, set the `exact` option to `true`. This
* setting is already enabled by default for `is` and `asserts` functions,
* treating absent properties strictly unless overridden.
*
* default: false
*
* @since 3.10.0
*/
readonly exact?: boolean | undefined
}
Since v3.10.0
PropertySignature (class)
Signature
declare class PropertySignature { constructor(
readonly name: PropertyKey,
type: AST,
isOptional: boolean,
readonly isReadonly: boolean,
annotations?: Annotations
) }
Since v3.10.0
toString (method)
Signature
declare const toString: () => string
Since v3.10.0
toJSON (method)
Signature
declare const toJSON: () => object
Since v3.10.0
PropertySignatureTransformation (class)
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(
readonly from: PropertyKey,
readonly to: PropertyKey,
readonly decode: (o: Option.Option<any>) => Option.Option<any>,
readonly encode: (o: Option.Option<any>) => Option.Option<any>
) }
Since v3.10.0
Refinement (class)
Signature
declare class Refinement<From> { constructor(
readonly from: From,
readonly filter: (
input: any,
options: ParseOptions,
self: Refinement
) => Option.Option<ParseIssue>,
readonly annotations: Annotations = {}
) }
Since v3.10.0
toString (method)
Signature
declare const toString: () => string
Since v3.10.0
toJSON (method)
Signature
declare const toJSON: () => object
Since v3.10.0
_tag (property)
Signature
readonly _tag: "Refinement"
Since v3.10.0
StringKeyword (class)
Signature
declare class StringKeyword { constructor(readonly annotations: Annotations = {}) }
Since v3.10.0
toString (method)
Signature
declare const toString: () => string
Since v3.10.0
toJSON (method)
Signature
declare const toJSON: () => object
Since v3.10.0
_tag (property)
Signature
readonly _tag: "StringKeyword"
Since v3.10.0
Suspend (class)
Signature
declare class Suspend { constructor(readonly f: () => AST, readonly annotations: Annotations = {}) }
Since v3.10.0
toString (method)
Signature
declare const toString: () => string
Since v3.10.0
toJSON (method)
Signature
declare const toJSON: () => object
Since v3.10.0
_tag (property)
Signature
readonly _tag: "Suspend"
Since v3.10.0
SymbolKeyword (class)
Signature
declare class SymbolKeyword { constructor(readonly annotations: Annotations = {}) }
Since v3.10.0
toString (method)
Signature
declare const toString: () => string
Since v3.10.0
toJSON (method)
Signature
declare const toJSON: () => object
Since v3.10.0
_tag (property)
Signature
readonly _tag: "SymbolKeyword"
Since v3.10.0
TemplateLiteral (class)
Signature
declare class TemplateLiteral { constructor(
readonly head: string,
readonly spans: Arr.NonEmptyReadonlyArray<TemplateLiteralSpan>,
readonly annotations: Annotations = {}
) }
Since v3.10.0
toString (method)
Signature
declare const toString: () => string
Since v3.10.0
toJSON (method)
Signature
declare const toJSON: () => object
Since v3.10.0
_tag (property)
Signature
readonly _tag: "TemplateLiteral"
Since v3.10.0
TemplateLiteralSpan (class)
Signature
declare class TemplateLiteralSpan { constructor(type: AST, readonly literal: string) }
Since v3.10.0
toString (method)
Signature
declare const toString: () => string
Since v3.10.0
toJSON (method)
Signature
declare const toJSON: () => object
Since v3.10.0
type (property)
Signature
readonly type: TemplateLiteralSpanType
Since v3.10.0
Transformation (class)
Signature
declare class Transformation { constructor(
readonly from: AST,
readonly to: AST,
readonly transformation: TransformationKind,
readonly annotations: Annotations = {}
) }
Since v3.10.0
toString (method)
Signature
declare const toString: () => string
Since v3.10.0
toJSON (method)
Signature
declare const toJSON: () => object
Since v3.10.0
_tag (property)
Signature
readonly _tag: "Transformation"
Since v3.10.0
TransformationKind (type alias)
Signature
type TransformationKind = FinalTransformation | ComposeTransformation | TypeLiteralTransformation
Since v3.10.0
TupleType (class)
Signature
declare class TupleType { constructor(
readonly elements: ReadonlyArray<OptionalType>,
readonly rest: ReadonlyArray<Type>,
readonly isReadonly: boolean,
readonly annotations: Annotations = {}
) }
Since v3.10.0
toString (method)
Signature
declare const toString: () => string
Since v3.10.0
toJSON (method)
Signature
declare const toJSON: () => object
Since v3.10.0
_tag (property)
Signature
readonly _tag: "TupleType"
Since v3.10.0
Type (class)
Signature
declare class Type { constructor(
readonly type: AST,
readonly annotations: Annotations = {}
) }
Since v3.10.0
toJSON (method)
Signature
declare const toJSON: () => object
Since v3.10.0
toString (method)
Signature
declare const toString: () => string
Since v3.10.0
TypeLiteral (class)
Signature
declare class TypeLiteral { constructor(
propertySignatures: ReadonlyArray<PropertySignature>,
indexSignatures: ReadonlyArray<IndexSignature>,
readonly annotations: Annotations = {}
) }
Since v3.10.0
toString (method)
Signature
declare const toString: () => string
Since v3.10.0
toJSON (method)
Signature
declare const toJSON: () => object
Since v3.10.0
_tag (property)
Signature
readonly _tag: "TypeLiteral"
Since v3.10.0
propertySignatures (property)
Signature
readonly propertySignatures: ReadonlyArray<PropertySignature>
Since v3.10.0
indexSignatures (property)
Signature
readonly indexSignatures: ReadonlyArray<IndexSignature>
Since v3.10.0
TypeLiteralTransformation (class)
Signature
declare class TypeLiteralTransformation { constructor(
readonly propertySignatureTransformations: ReadonlyArray<
PropertySignatureTransformation
>
) }
Since v3.10.0
_tag (property)
Signature
readonly _tag: "TypeLiteralTransformation"
Since v3.10.0
UndefinedKeyword (class)
Signature
declare class UndefinedKeyword { constructor(readonly annotations: Annotations = {}) }
Since v3.10.0
toString (method)
Signature
declare const toString: () => string
Since v3.10.0
toJSON (method)
Signature
declare const toJSON: () => object
Since v3.10.0
_tag (property)
Signature
readonly _tag: "UndefinedKeyword"
Since v3.10.0
Union (class)
Signature
declare class Union<M> { private constructor(readonly types: Members<M>, readonly annotations: Annotations = {}) }
Since v3.10.0
toString (method)
Signature
declare const toString: () => string
Since v3.10.0
toJSON (method)
Signature
declare const toJSON: () => object
Since v3.10.0
_tag (property)
Signature
readonly _tag: "Union"
Since v3.10.0
UniqueSymbol (class)
Signature
declare class UniqueSymbol { constructor(readonly symbol: symbol, readonly annotations: Annotations = {}) }
Since v3.10.0
toString (method)
Signature
declare const toString: () => string
Since v3.10.0
toJSON (method)
Signature
declare const toJSON: () => object
Since v3.10.0
_tag (property)
Signature
readonly _tag: "UniqueSymbol"
Since v3.10.0
UnknownKeyword (class)
Signature
declare class UnknownKeyword { constructor(readonly annotations: Annotations = {}) }
Since v3.10.0
toString (method)
Signature
declare const toString: () => string
Since v3.10.0
toJSON (method)
Signature
declare const toJSON: () => object
Since v3.10.0
_tag (property)
Signature
readonly _tag: "UnknownKeyword"
Since v3.10.0
VoidKeyword (class)
Signature
declare class VoidKeyword { constructor(readonly annotations: Annotations = {}) }
Since v3.10.0
toString (method)
Signature
declare const toString: () => string
Since v3.10.0
toJSON (method)
Signature
declare const toJSON: () => object
Since v3.10.0
_tag (property)
Signature
readonly _tag: "VoidKeyword"
Since v3.10.0
schema id
ParseJsonSchemaId
Signature
declare const ParseJsonSchemaId: unique symbol
Since v3.10.0
utils
Compiler (type alias)
Signature
type Compiler<A> = (ast: AST, path: ReadonlyArray<PropertyKey>) => A
Since v3.10.0
Match (type alias)
Signature
type Match<A> = {
[K in AST["_tag"]]: (ast: Extract<AST, { _tag: K }>, compile: Compiler<A>, path: ReadonlyArray<PropertyKey>) => A
}
Since v3.10.0
Members (type alias)
Signature
type readonly [A, A, ...A[]] = readonly [A, A, ...Array<A>]
Since v3.10.0
Parameter (type alias)
Signature
type Parameter = StringKeyword | SymbolKeyword | TemplateLiteral | Refinement<Parameter>
Since v3.10.0
annotations
Merges a set of new annotations with existing ones, potentially overwriting any duplicates.
Signature
declare const annotations: (ast: AST, overrides: Annotations) => AST
Since v3.10.0
defaultParseOption
Signature
declare const defaultParseOption: ParseOptions
Since v3.10.0
encodedAST
Signature
declare const encodedAST: (ast: AST) => AST
Since v3.10.0
encodedBoundAST
Signature
declare const encodedBoundAST: (ast: AST) => AST
Since v3.10.0
getCompiler
Signature
declare const getCompiler: <A>(match: Match<A>) => Compiler<A>
Since v3.10.0
getPropertySignatures
Signature
declare const getPropertySignatures: (ast: AST) => Array<PropertySignature>
Since v3.10.0
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 const getTemplateLiteralCapturingRegExp: (ast: TemplateLiteral) => RegExp
Since v3.10.0
getTemplateLiteralRegExp
Generates a regular expression from a TemplateLiteral
AST node.
See
getTemplateLiteralCapturingRegExp
for a variant that captures the pattern.
Signature
declare const getTemplateLiteralRegExp: (ast: TemplateLiteral) => RegExp
Since v3.10.0
isParameter
Signature
declare const isParameter: (ast: AST) => ast is Parameter
Since v3.10.0
keyof
Equivalent at runtime to the TypeScript type-level keyof
operator.
Signature
declare const keyof: (ast: AST) => AST
Since v3.10.0
mutable
Creates a new AST with shallow mutability applied to its properties.
Signature
declare const mutable: (ast: AST) => AST
Since v3.10.0
omit
Equivalent at runtime to the built-in TypeScript utility type Omit
.
Signature
declare const omit: (ast: AST, keys: ReadonlyArray<PropertyKey>) => TypeLiteral | Transformation
Since v3.10.0
partial
Equivalent at runtime to the built-in TypeScript utility type Partial
.
Signature
declare const partial: (ast: AST, options?: { readonly exact: true }) => AST
Since v3.10.0
pick
Equivalent at runtime to the built-in TypeScript utility type Pick
.
Signature
declare const pick: (ast: AST, keys: ReadonlyArray<PropertyKey>) => TypeLiteral | Transformation
Since v3.10.0
required
Equivalent at runtime to the built-in TypeScript utility type Required
.
Signature
declare const required: (ast: AST) => AST
Since v3.10.0
typeAST
Signature
declare const typeAST: (ast: AST) => AST
Since v3.10.0