SchemaAST overview
Added in v3.10.0
Table of contents
- 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
- 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
}
Added in v3.10.0
Annotations (interface)
Signature
export interface Annotations {
readonly [_: string]: unknown
readonly [_: symbol]: unknown
}
Added in v3.10.0
ArbitraryAnnotationId
Signature
export declare const ArbitraryAnnotationId: typeof ArbitraryAnnotationId
Added in v3.10.0
BatchingAnnotation (type alias)
Signature
export type BatchingAnnotation = boolean | "inherit" | undefined
Added in v3.10.0
BatchingAnnotationId
Signature
export declare const BatchingAnnotationId: typeof BatchingAnnotationId
Added in v3.10.0
BrandAnnotation (type alias)
Signature
export type BrandAnnotation = Arr.NonEmptyReadonlyArray<string | symbol>
Added in v3.10.0
BrandAnnotationId
Signature
export declare const BrandAnnotationId: typeof BrandAnnotationId
Added in v3.10.0
ConcurrencyAnnotation (type alias)
Signature
export type ConcurrencyAnnotation = Concurrency | undefined
Added in v3.10.0
ConcurrencyAnnotationId
Signature
export declare const ConcurrencyAnnotationId: typeof ConcurrencyAnnotationId
Added in v3.10.0
DecodingFallbackAnnotation (type alias)
Signature
export type DecodingFallbackAnnotation<A> = (issue: ParseIssue) => Effect<A, ParseIssue>
Added in v3.10.0
DecodingFallbackAnnotationId
Signature
export declare const DecodingFallbackAnnotationId: typeof DecodingFallbackAnnotationId
Added in v3.10.0
DefaultAnnotation (type alias)
Signature
export type DefaultAnnotation<A> = A
Added in v3.10.0
DefaultAnnotationId
Signature
export declare const DefaultAnnotationId: typeof DefaultAnnotationId
Added in v3.10.0
DescriptionAnnotation (type alias)
Signature
export type DescriptionAnnotation = string
Added in v3.10.0
DescriptionAnnotationId
Signature
export declare const DescriptionAnnotationId: typeof DescriptionAnnotationId
Added in v3.10.0
DocumentationAnnotation (type alias)
Signature
export type DocumentationAnnotation = string
Added in v3.10.0
DocumentationAnnotationId
Signature
export declare const DocumentationAnnotationId: typeof DocumentationAnnotationId
Added in v3.10.0
EquivalenceAnnotation (type alias)
Signature
export type EquivalenceAnnotation<A, TypeParameters extends ReadonlyArray<any> = readonly []> = (
...equivalences: { readonly [K in keyof TypeParameters]: Equivalence<TypeParameters[K]> }
) => Equivalence<A>
Added in v3.10.0
EquivalenceAnnotationId
Signature
export declare const EquivalenceAnnotationId: typeof EquivalenceAnnotationId
Added in v3.10.0
ExamplesAnnotation (type alias)
Signature
export type ExamplesAnnotation<A> = Arr.NonEmptyReadonlyArray<A>
Added in v3.10.0
ExamplesAnnotationId
Signature
export declare const ExamplesAnnotationId: typeof ExamplesAnnotationId
Added in v3.10.0
IdentifierAnnotation (type alias)
Signature
export type IdentifierAnnotation = string
Added in v3.10.0
IdentifierAnnotationId
Signature
export declare const IdentifierAnnotationId: typeof IdentifierAnnotationId
Added in v3.10.0
JSONIdentifierAnnotationId
Signature
export declare const JSONIdentifierAnnotationId: typeof JSONIdentifierAnnotationId
Added in v3.10.0
JSONSchemaAnnotation (type alias)
Signature
export type JSONSchemaAnnotation = object
Added in v3.10.0
JSONSchemaAnnotationId
Signature
export declare const JSONSchemaAnnotationId: typeof JSONSchemaAnnotationId
Added in v3.10.0
MessageAnnotation (type alias)
Signature
export type MessageAnnotation = (issue: ParseIssue) =>
| string
| Effect<string>
| {
readonly message: string | Effect<string>
readonly override: boolean
}
Added in v3.10.0
MessageAnnotationId
Signature
export declare const MessageAnnotationId: typeof MessageAnnotationId
Added in v3.10.0
MissingMessageAnnotation (type alias)
Signature
export type MissingMessageAnnotation = () => string | Effect<string>
Added in v3.10.0
MissingMessageAnnotationId
Signature
export declare const MissingMessageAnnotationId: typeof MissingMessageAnnotationId
Added in v3.10.0
ParseIssueTitleAnnotation (type alias)
Signature
export type ParseIssueTitleAnnotation = (issue: ParseIssue) => string | undefined
Added in v3.10.0
ParseIssueTitleAnnotationId
Signature
export declare const ParseIssueTitleAnnotationId: typeof ParseIssueTitleAnnotationId
Added in v3.10.0
ParseOptionsAnnotationId
Signature
export declare const ParseOptionsAnnotationId: typeof ParseOptionsAnnotationId
Added in v3.10.0
PrettyAnnotationId
Signature
export declare const PrettyAnnotationId: typeof PrettyAnnotationId
Added in v3.10.0
SchemaIdAnnotation (type alias)
Signature
export type SchemaIdAnnotation = string | symbol
Added in v3.10.0
SchemaIdAnnotationId
Signature
export declare const SchemaIdAnnotationId: typeof SchemaIdAnnotationId
Added in v3.10.0
SurrogateAnnotation (type alias)
Signature
export type SurrogateAnnotation = AST
Added in v3.10.0
SurrogateAnnotationId
Signature
export declare const SurrogateAnnotationId: typeof SurrogateAnnotationId
Added in v3.10.0
TitleAnnotation (type alias)
Signature
export type TitleAnnotation = string
Added in v3.10.0
TitleAnnotationId
Signature
export declare const TitleAnnotationId: typeof TitleAnnotationId
Added in v3.10.0
getAnnotation
Signature
export declare const getAnnotation: {
<A>(key: symbol): (annotated: Annotated) => Option.Option<A>
<A>(annotated: Annotated, key: symbol): Option.Option<A>
}
Added in v3.10.0
getBatchingAnnotation
Signature
export declare const getBatchingAnnotation: (annotated: Annotated) => Option.Option<BatchingAnnotation>
Added in v3.10.0
getBrandAnnotation
Signature
export declare const getBrandAnnotation: (
annotated: Annotated
) => Option.Option<readonly [string | symbol, ...(string | symbol)[]]>
Added in v3.10.0
getConcurrencyAnnotation
Signature
export declare const getConcurrencyAnnotation: (annotated: Annotated) => Option.Option<ConcurrencyAnnotation>
Added in v3.10.0
getDecodingFallbackAnnotation
Signature
export declare const getDecodingFallbackAnnotation: (
annotated: Annotated
) => Option.Option<DecodingFallbackAnnotation<unknown>>
Added in v3.10.0
getDefaultAnnotation
Signature
export declare const getDefaultAnnotation: (annotated: Annotated) => Option.Option<unknown>
Added in v3.10.0
getDescriptionAnnotation
Signature
export declare const getDescriptionAnnotation: (annotated: Annotated) => Option.Option<string>
Added in v3.10.0
getDocumentationAnnotation
Signature
export declare const getDocumentationAnnotation: (annotated: Annotated) => Option.Option<string>
Added in v3.10.0
getExamplesAnnotation
Signature
export declare const getExamplesAnnotation: (annotated: Annotated) => Option.Option<readonly [unknown, ...unknown[]]>
Added in v3.10.0
getIdentifierAnnotation
Signature
export declare const getIdentifierAnnotation: (annotated: Annotated) => Option.Option<string>
Added in v3.10.0
getJSONIdentifier
Signature
export declare const getJSONIdentifier: (annotated: Annotated) => Option.Option<string>
Added in v3.10.0
getJSONIdentifierAnnotation
Signature
export declare const getJSONIdentifierAnnotation: (annotated: Annotated) => Option.Option<string>
Added in v3.10.0
getJSONSchemaAnnotation
Signature
export declare const getJSONSchemaAnnotation: (annotated: Annotated) => Option.Option<object>
Added in v3.10.0
getMessageAnnotation
Signature
export declare const getMessageAnnotation: (annotated: Annotated) => Option.Option<MessageAnnotation>
Added in v3.10.0
getMissingMessageAnnotation
Signature
export declare const getMissingMessageAnnotation: (annotated: Annotated) => Option.Option<MissingMessageAnnotation>
Added in v3.10.0
getParseIssueTitleAnnotation
Signature
export declare const getParseIssueTitleAnnotation: (annotated: Annotated) => Option.Option<ParseIssueTitleAnnotation>
Added in v3.10.0
getParseOptionsAnnotation
Signature
export declare const getParseOptionsAnnotation: (annotated: Annotated) => Option.Option<ParseOptions>
Added in v3.10.0
getSurrogateAnnotation
Signature
export declare const getSurrogateAnnotation: (annotated: Annotated) => Option.Option<AST>
Added in v3.10.0
getTitleAnnotation
Signature
export declare const getTitleAnnotation: (annotated: Annotated) => Option.Option<string>
Added in v3.10.0
constructors
anyKeyword
Signature
export declare const anyKeyword: AnyKeyword
Added in v3.10.0
bigIntKeyword
Signature
export declare const bigIntKeyword: BigIntKeyword
Added in v3.10.0
booleanKeyword
Signature
export declare const booleanKeyword: BooleanKeyword
Added in v3.10.0
composeTransformation
Signature
export declare const composeTransformation: ComposeTransformation
Added in v3.10.0
neverKeyword
Signature
export declare const neverKeyword: NeverKeyword
Added in v3.10.0
null
Signature
export declare const null: Literal
Added in v3.10.0
numberKeyword
Signature
export declare const numberKeyword: NumberKeyword
Added in v3.10.0
objectKeyword
Signature
export declare const objectKeyword: ObjectKeyword
Added in v3.10.0
stringKeyword
Signature
export declare const stringKeyword: StringKeyword
Added in v3.10.0
symbolKeyword
Signature
export declare const symbolKeyword: SymbolKeyword
Added in v3.10.0
undefinedKeyword
Signature
export declare const undefinedKeyword: UndefinedKeyword
Added in v3.10.0
unknownKeyword
Signature
export declare const unknownKeyword: UnknownKeyword
Added in v3.10.0
voidKeyword
Signature
export declare const voidKeyword: VoidKeyword
Added in v3.10.0
guards
isAnyKeyword
Signature
export declare const isAnyKeyword: (ast: AST) => ast is AnyKeyword
Added in v3.10.0
isBigIntKeyword
Signature
export declare const isBigIntKeyword: (ast: AST) => ast is BigIntKeyword
Added in v3.10.0
isBooleanKeyword
Signature
export declare const isBooleanKeyword: (ast: AST) => ast is BooleanKeyword
Added in v3.10.0
isComposeTransformation
Signature
export declare const isComposeTransformation: (ast: TransformationKind) => ast is ComposeTransformation
Added in v3.10.0
isDeclaration
Signature
export declare const isDeclaration: (ast: AST) => ast is Declaration
Added in v3.10.0
isEnums
Signature
export declare const isEnums: (ast: AST) => ast is Enums
Added in v3.10.0
isFinalTransformation
Signature
export declare const isFinalTransformation: (ast: TransformationKind) => ast is FinalTransformation
Added in v3.10.0
isLiteral
Signature
export declare const isLiteral: (ast: AST) => ast is Literal
Added in v3.10.0
isNeverKeyword
Signature
export declare const isNeverKeyword: (ast: AST) => ast is NeverKeyword
Added in v3.10.0
isNumberKeyword
Signature
export declare const isNumberKeyword: (ast: AST) => ast is NumberKeyword
Added in v3.10.0
isObjectKeyword
Signature
export declare const isObjectKeyword: (ast: AST) => ast is ObjectKeyword
Added in v3.10.0
isRefinement
Signature
export declare const isRefinement: (ast: AST) => ast is Refinement<AST>
Added in v3.10.0
isStringKeyword
Signature
export declare const isStringKeyword: (ast: AST) => ast is StringKeyword
Added in v3.10.0
isSuspend
Signature
export declare const isSuspend: (ast: AST) => ast is Suspend
Added in v3.10.0
isSymbolKeyword
Signature
export declare const isSymbolKeyword: (ast: AST) => ast is SymbolKeyword
Added in v3.10.0
isTemplateLiteral
Signature
export declare const isTemplateLiteral: (ast: AST) => ast is TemplateLiteral
Added in v3.10.0
isTransformation
Signature
export declare const isTransformation: (ast: AST) => ast is Transformation
Added in v3.10.0
isTupleType
Signature
export declare const isTupleType: (ast: AST) => ast is TupleType
Added in v3.10.0
isTypeLiteral
Signature
export declare const isTypeLiteral: (ast: AST) => ast is TypeLiteral
Added in v3.10.0
isTypeLiteralTransformation
Signature
export declare const isTypeLiteralTransformation: (ast: TransformationKind) => ast is TypeLiteralTransformation
Added in v3.10.0
isUndefinedKeyword
Signature
export declare const isUndefinedKeyword: (ast: AST) => ast is UndefinedKeyword
Added in v3.10.0
isUnion
Signature
export declare const isUnion: (ast: AST) => ast is Union
Added in v3.10.0
isUniqueSymbol
Signature
export declare const isUniqueSymbol: (ast: AST) => ast is UniqueSymbol
Added in v3.10.0
isUnknownKeyword
Signature
export declare const isUnknownKeyword: (ast: AST) => ast is UnknownKeyword
Added in v3.10.0
isVoidKeyword
Signature
export declare const isVoidKeyword: (ast: AST) => ast is VoidKeyword
Added in v3.10.0
model
AST (type alias)
Signature
export 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
Added in v3.10.0
AnyKeyword (class)
Signature
export declare class AnyKeyword { constructor(readonly annotations: Annotations = {}) }
Added in v3.10.0
toString (method)
Signature
toString()
Added in v3.10.0
toJSON (method)
Signature
toJSON(): object
Added in v3.10.0
_tag (property)
Signature
readonly _tag: "AnyKeyword"
Added in v3.10.0
BigIntKeyword (class)
Signature
export declare class BigIntKeyword { constructor(readonly annotations: Annotations = {}) }
Added in v3.10.0
toString (method)
Signature
toString()
Added in v3.10.0
toJSON (method)
Signature
toJSON(): object
Added in v3.10.0
_tag (property)
Signature
readonly _tag: "BigIntKeyword"
Added in v3.10.0
BooleanKeyword (class)
Signature
export declare class BooleanKeyword { constructor(readonly annotations: Annotations = {}) }
Added in v3.10.0
toString (method)
Signature
toString()
Added in v3.10.0
toJSON (method)
Signature
toJSON(): object
Added in v3.10.0
_tag (property)
Signature
readonly _tag: "BooleanKeyword"
Added in v3.10.0
ComposeTransformation (class)
Signature
export declare class ComposeTransformation
Added in v3.10.0
_tag (property)
Signature
readonly _tag: "ComposeTransformation"
Added in v3.10.0
Declaration (class)
Signature
export 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 = {}
) }
Added in v3.10.0
toString (method)
Signature
toString()
Added in v3.10.0
toJSON (method)
Signature
toJSON(): object
Added in v3.10.0
_tag (property)
Signature
readonly _tag: "Declaration"
Added in v3.10.0
Enums (class)
Signature
export declare class Enums { constructor(
readonly enums: ReadonlyArray<readonly [string, string | number]>,
readonly annotations: Annotations = {}
) }
Added in v3.10.0
toString (method)
Signature
toString()
Added in v3.10.0
toJSON (method)
Signature
toJSON(): object
Added in v3.10.0
_tag (property)
Signature
readonly _tag: "Enums"
Added in v3.10.0
FinalTransformation (class)
Signature
export 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>
) }
Added in v3.10.0
_tag (property)
Signature
readonly _tag: "FinalTransformation"
Added in v3.10.0
IndexSignature (class)
Signature
export declare class IndexSignature { constructor(
parameter: AST,
readonly type: AST,
readonly isReadonly: boolean
) }
Added in v3.10.0
toString (method)
Signature
toString(): string
Added in v3.10.0
toJSON (method)
Signature
toJSON(): object
Added in v3.10.0
parameter (property)
Signature
readonly parameter: Parameter
Added in v3.10.0
Literal (class)
Signature
export declare class Literal { constructor(readonly literal: LiteralValue, readonly annotations: Annotations = {}) }
Added in v3.10.0
toString (method)
Signature
toString()
Added in v3.10.0
toJSON (method)
Signature
toJSON(): object
Added in v3.10.0
_tag (property)
Signature
readonly _tag: "Literal"
Added in v3.10.0
LiteralValue (type alias)
Signature
export type LiteralValue = string | number | boolean | null | bigint
Added in v3.10.0
NeverKeyword (class)
Signature
export declare class NeverKeyword { constructor(readonly annotations: Annotations = {}) }
Added in v3.10.0
toString (method)
Signature
toString()
Added in v3.10.0
toJSON (method)
Signature
toJSON(): object
Added in v3.10.0
_tag (property)
Signature
readonly _tag: "NeverKeyword"
Added in v3.10.0
NumberKeyword (class)
Signature
export declare class NumberKeyword { constructor(readonly annotations: Annotations = {}) }
Added in v3.10.0
toString (method)
Signature
toString()
Added in v3.10.0
toJSON (method)
Signature
toJSON(): object
Added in v3.10.0
_tag (property)
Signature
readonly _tag: "NumberKeyword"
Added in v3.10.0
ObjectKeyword (class)
Signature
export declare class ObjectKeyword { constructor(readonly annotations: Annotations = {}) }
Added in v3.10.0
toString (method)
Signature
toString()
Added in v3.10.0
toJSON (method)
Signature
toJSON(): object
Added in v3.10.0
_tag (property)
Signature
readonly _tag: "ObjectKeyword"
Added in v3.10.0
OptionalType (class)
Signature
export declare class OptionalType { constructor(
type: AST,
readonly isOptional: boolean,
annotations: Annotations = {}
) }
Added in v3.10.0
toJSON (method)
Signature
toJSON(): object
Added in v3.10.0
toString (method)
Signature
toString()
Added in 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
}
Added in v3.10.0
PropertySignature (class)
Signature
export declare class PropertySignature { constructor(
readonly name: PropertyKey,
type: AST,
isOptional: boolean,
readonly isReadonly: boolean,
annotations?: Annotations
) }
Added in v3.10.0
toString (method)
Signature
toString(): string
Added in v3.10.0
toJSON (method)
Signature
toJSON(): object
Added in 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
export 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>
) }
Added in v3.10.0
Refinement (class)
Signature
export declare class Refinement<From> { constructor(
readonly from: From,
readonly filter: (
input: any,
options: ParseOptions,
self: Refinement
) => Option.Option<ParseIssue>,
readonly annotations: Annotations = {}
) }
Added in v3.10.0
toString (method)
Signature
toString()
Added in v3.10.0
toJSON (method)
Signature
toJSON(): object
Added in v3.10.0
_tag (property)
Signature
readonly _tag: "Refinement"
Added in v3.10.0
StringKeyword (class)
Signature
export declare class StringKeyword { constructor(readonly annotations: Annotations = {}) }
Added in v3.10.0
toString (method)
Signature
toString()
Added in v3.10.0
toJSON (method)
Signature
toJSON(): object
Added in v3.10.0
_tag (property)
Signature
readonly _tag: "StringKeyword"
Added in v3.10.0
Suspend (class)
Signature
export declare class Suspend { constructor(readonly f: () => AST, readonly annotations: Annotations = {}) }
Added in v3.10.0
toString (method)
Signature
toString()
Added in v3.10.0
toJSON (method)
Signature
toJSON(): object
Added in v3.10.0
_tag (property)
Signature
readonly _tag: "Suspend"
Added in v3.10.0
SymbolKeyword (class)
Signature
export declare class SymbolKeyword { constructor(readonly annotations: Annotations = {}) }
Added in v3.10.0
toString (method)
Signature
toString()
Added in v3.10.0
toJSON (method)
Signature
toJSON(): object
Added in v3.10.0
_tag (property)
Signature
readonly _tag: "SymbolKeyword"
Added in v3.10.0
TemplateLiteral (class)
Signature
export declare class TemplateLiteral { constructor(
readonly head: string,
readonly spans: Arr.NonEmptyReadonlyArray<TemplateLiteralSpan>,
readonly annotations: Annotations = {}
) }
Added in v3.10.0
toString (method)
Signature
toString()
Added in v3.10.0
toJSON (method)
Signature
toJSON(): object
Added in v3.10.0
_tag (property)
Signature
readonly _tag: "TemplateLiteral"
Added in v3.10.0
TemplateLiteralSpan (class)
Signature
export declare class TemplateLiteralSpan { constructor(type: AST, readonly literal: string) }
Added in v3.10.0
toString (method)
Signature
toString()
Added in v3.10.0
toJSON (method)
Signature
toJSON(): object
Added in v3.10.0
type (property)
Signature
readonly type: TemplateLiteralSpanType
Added in v3.10.0
Transformation (class)
Signature
export declare class Transformation { constructor(
readonly from: AST,
readonly to: AST,
readonly transformation: TransformationKind,
readonly annotations: Annotations = {}
) }
Added in v3.10.0
toString (method)
Signature
toString()
Added in v3.10.0
toJSON (method)
Signature
toJSON(): object
Added in v3.10.0
_tag (property)
Signature
readonly _tag: "Transformation"
Added in v3.10.0
TransformationKind (type alias)
Signature
export type TransformationKind = FinalTransformation | ComposeTransformation | TypeLiteralTransformation
Added in v3.10.0
TupleType (class)
Signature
export declare class TupleType { constructor(
readonly elements: ReadonlyArray<OptionalType>,
readonly rest: ReadonlyArray<Type>,
readonly isReadonly: boolean,
readonly annotations: Annotations = {}
) }
Added in v3.10.0
toString (method)
Signature
toString()
Added in v3.10.0
toJSON (method)
Signature
toJSON(): object
Added in v3.10.0
_tag (property)
Signature
readonly _tag: "TupleType"
Added in v3.10.0
Type (class)
Signature
export declare class Type { constructor(
readonly type: AST,
readonly annotations: Annotations = {}
) }
Added in v3.10.0
toJSON (method)
Signature
toJSON(): object
Added in v3.10.0
toString (method)
Signature
toString()
Added in v3.10.0
TypeLiteral (class)
Signature
export declare class TypeLiteral { constructor(
propertySignatures: ReadonlyArray<PropertySignature>,
indexSignatures: ReadonlyArray<IndexSignature>,
readonly annotations: Annotations = {}
) }
Added in v3.10.0
toString (method)
Signature
toString()
Added in v3.10.0
toJSON (method)
Signature
toJSON(): object
Added in v3.10.0
_tag (property)
Signature
readonly _tag: "TypeLiteral"
Added in v3.10.0
propertySignatures (property)
Signature
readonly propertySignatures: readonly PropertySignature[]
Added in v3.10.0
indexSignatures (property)
Signature
readonly indexSignatures: readonly IndexSignature[]
Added in v3.10.0
TypeLiteralTransformation (class)
Signature
export declare class TypeLiteralTransformation { constructor(
readonly propertySignatureTransformations: ReadonlyArray<
PropertySignatureTransformation
>
) }
Added in v3.10.0
_tag (property)
Signature
readonly _tag: "TypeLiteralTransformation"
Added in v3.10.0
UndefinedKeyword (class)
Signature
export declare class UndefinedKeyword { constructor(readonly annotations: Annotations = {}) }
Added in v3.10.0
toString (method)
Signature
toString()
Added in v3.10.0
toJSON (method)
Signature
toJSON(): object
Added in v3.10.0
_tag (property)
Signature
readonly _tag: "UndefinedKeyword"
Added in v3.10.0
Union (class)
Signature
export declare class Union<M> { private constructor(readonly types: Members<M>, readonly annotations: Annotations = {}) }
Added in v3.10.0
toString (method)
Signature
toString()
Added in v3.10.0
toJSON (method)
Signature
toJSON(): object
Added in v3.10.0
_tag (property)
Signature
readonly _tag: "Union"
Added in v3.10.0
UniqueSymbol (class)
Signature
export declare class UniqueSymbol { constructor(readonly symbol: symbol, readonly annotations: Annotations = {}) }
Added in v3.10.0
toString (method)
Signature
toString()
Added in v3.10.0
toJSON (method)
Signature
toJSON(): object
Added in v3.10.0
_tag (property)
Signature
readonly _tag: "UniqueSymbol"
Added in v3.10.0
UnknownKeyword (class)
Signature
export declare class UnknownKeyword { constructor(readonly annotations: Annotations = {}) }
Added in v3.10.0
toString (method)
Signature
toString()
Added in v3.10.0
toJSON (method)
Signature
toJSON(): object
Added in v3.10.0
_tag (property)
Signature
readonly _tag: "UnknownKeyword"
Added in v3.10.0
VoidKeyword (class)
Signature
export declare class VoidKeyword { constructor(readonly annotations: Annotations = {}) }
Added in v3.10.0
toString (method)
Signature
toString()
Added in v3.10.0
toJSON (method)
Signature
toJSON(): object
Added in v3.10.0
_tag (property)
Signature
readonly _tag: "VoidKeyword"
Added in v3.10.0
schema id
ParseJsonSchemaId
Signature
export declare const ParseJsonSchemaId: typeof ParseJsonSchemaId
Added in v3.10.0
utils
Compiler (type alias)
Signature
export type Compiler<A> = (ast: AST, path: ReadonlyArray<PropertyKey>) => A
Added in v3.10.0
Match (type alias)
Signature
export type Match<A> = {
[K in AST["_tag"]]: (ast: Extract<AST, { _tag: K }>, compile: Compiler<A>, path: ReadonlyArray<PropertyKey>) => A
}
Added in v3.10.0
Members (type alias)
Signature
export type Members<A> = readonly [A, A, ...Array<A>]
Added in v3.10.0
Parameter (type alias)
Signature
export type Parameter = StringKeyword | SymbolKeyword | TemplateLiteral | Refinement<Parameter>
Added in v3.10.0
annotations
Merges a set of new annotations with existing ones, potentially overwriting any duplicates.
Signature
export declare const annotations: (ast: AST, a: Annotations) => AST
Added in v3.10.0
defaultParseOption
Signature
export declare const defaultParseOption: ParseOptions
Added in v3.10.0
encodedAST
Signature
export declare const encodedAST: (ast: AST) => AST
Added in v3.10.0
encodedBoundAST
Signature
export declare const encodedBoundAST: (ast: AST) => AST
Added in v3.10.0
getCompiler
Signature
export declare const getCompiler: <A>(match: Match<A>) => Compiler<A>
Added in v3.10.0
getPropertySignatures
Signature
export declare const getPropertySignatures: (ast: AST) => Array<PropertySignature>
Added in v3.10.0
getTemplateLiteralCapturingRegExp
Signature
export declare const getTemplateLiteralCapturingRegExp: (ast: TemplateLiteral) => RegExp
Added in v3.10.0
getTemplateLiteralRegExp
Signature
export declare const getTemplateLiteralRegExp: (ast: TemplateLiteral) => RegExp
Added in v3.10.0
isParameter
Signature
export declare const isParameter: (ast: AST) => ast is Parameter
Added in v3.10.0
keyof
Equivalent at runtime to the TypeScript type-level keyof
operator.
Signature
export declare const keyof: (ast: AST) => AST
Added in v3.10.0
mutable
Creates a new AST with shallow mutability applied to its properties.
Signature
export declare const mutable: (ast: AST) => AST
Added in v3.10.0
omit
Equivalent at runtime to the built-in TypeScript utility type Omit
.
Signature
export declare const omit: (ast: AST, keys: ReadonlyArray<PropertyKey>) => TypeLiteral | Transformation
Added in v3.10.0
partial
Equivalent at runtime to the built-in TypeScript utility type Partial
.
Signature
export declare const partial: (ast: AST, options?: { readonly exact: true }) => AST
Added in v3.10.0
pick
Equivalent at runtime to the built-in TypeScript utility type Pick
.
Signature
export declare const pick: (ast: AST, keys: ReadonlyArray<PropertyKey>) => TypeLiteral | Transformation
Added in v3.10.0
required
Equivalent at runtime to the built-in TypeScript utility type Required
.
Signature
export declare const required: (ast: AST) => AST
Added in v3.10.0
typeAST
Signature
export declare const typeAST: (ast: AST) => AST
Added in v3.10.0