BaseRepresents the abstract base class for all AST node variants.
Details
Every AST node extends Base and inherits these fields:
annotations— user-supplied metadata (identifier, title, description, arbitrary keys).checks— optional Checks for post-type-match validation.encoding— optional Encoding chain for type ↔ wire transformations.context— optional Context for per-property metadata.
Subclasses add a _tag discriminant and variant-specific data.
export abstract class class Baseclass Base {
_tag: string;
annotations: Schema.Annotations.Annotations | undefined;
checks: Checks | undefined;
encoding: Encoding | undefined;
context: Context | undefined;
toString: () => string;
}
Represents the abstract base class for all
AST
node variants.
Details
Every AST node extends Base and inherits these fields:
annotations — user-supplied metadata (identifier, title, description,
arbitrary keys).
checks — optional
Checks
for post-type-match validation.
encoding — optional
Encoding
chain for type ↔ wire
transformations.
context — optional
Context
for per-property metadata.
Subclasses add a _tag discriminant and variant-specific data.
Base {
readonly [const TypeId: "~effect/Schema"TypeId] = const TypeId: "~effect/Schema"TypeId
abstract readonly Base._tag: string_tag: string
readonly Base.annotations: anyannotations: import SchemaSchema.declareAnnotations.type Schema.Annotations.Annotations = /*unresolved*/ anyAnnotations | undefined
readonly Base.checks: Checks | undefinedchecks: type Checks = readonly [
Check<any>,
...Check<any>[]
]
Non-empty array of validation
Check
values attached to an AST node
via
Base.checks
.
Details
Checks are run after basic type matching succeeds. They represent
refinements like minLength, pattern, int, etc.
Checks | undefined
readonly Base.encoding: Encoding | undefinedencoding: type Encoding = readonly [Link, ...Link[]]A non-empty chain of
Link
values representing the transformation
steps between a schema's decoded (type) form and its encoded (wire) form.
Details
Stored on
Base.encoding
. When undefined, the node has no
encoding transformation (type and encoded forms are identical).
Encoding | undefined
readonly Base.context: Context | undefinedcontext: class Contextclass Context {
isOptional: boolean;
isMutable: boolean;
defaultValue: Encoding | undefined;
annotations: Schema.Annotations.Key<unknown> | undefined;
}
Represents per-property metadata attached to AST nodes via
Base.context
.
Details
Tracks whether a property key is optional, mutable, has a constructor
default, or carries key-level annotations. Typically set by helpers like
optionalKey
and Schema.mutableKey.
isOptional — the property key may be absent from the input.
isMutable — the property is readonly when false.
defaultValue — an
Encoding
applied during construction to
supply missing values.
annotations — key-level annotations (e.g. description of the key
itself).
Context | undefined
constructor(
annotations: anyannotations: import SchemaSchema.declareAnnotations.type Schema.Annotations.Annotations = /*unresolved*/ anyAnnotations | undefined = var undefinedundefined,
checks: Checks | undefinedchecks: type Checks = readonly [
Check<any>,
...Check<any>[]
]
Non-empty array of validation
Check
values attached to an AST node
via
Base.checks
.
Details
Checks are run after basic type matching succeeds. They represent
refinements like minLength, pattern, int, etc.
Checks | undefined = var undefinedundefined,
encoding: Encoding | undefinedencoding: type Encoding = readonly [Link, ...Link[]]A non-empty chain of
Link
values representing the transformation
steps between a schema's decoded (type) form and its encoded (wire) form.
Details
Stored on
Base.encoding
. When undefined, the node has no
encoding transformation (type and encoded forms are identical).
Encoding | undefined = var undefinedundefined,
context: Context | undefinedcontext: class Contextclass Context {
isOptional: boolean;
isMutable: boolean;
defaultValue: Encoding | undefined;
annotations: Schema.Annotations.Key<unknown> | undefined;
}
Represents per-property metadata attached to AST nodes via
Base.context
.
Details
Tracks whether a property key is optional, mutable, has a constructor
default, or carries key-level annotations. Typically set by helpers like
optionalKey
and Schema.mutableKey.
isOptional — the property key may be absent from the input.
isMutable — the property is readonly when false.
defaultValue — an
Encoding
applied during construction to
supply missing values.
annotations — key-level annotations (e.g. description of the key
itself).
Context | undefined = var undefinedundefined
) {
this.Base.annotations: anyannotations = annotations: anyannotations
this.Base.checks: Checks | undefinedchecks = checks: Checks | undefinedchecks
this.Base.encoding: Encoding | undefinedencoding = encoding: Encoding | undefinedencoding
this.Base.context: Context | undefinedcontext = context: Context | undefinedcontext
}
Base.toString(): stringtoString() {
return `<${this.Base._tag: string_tag}>`
}
}