ArraysAST node for array-like types — both tuples and arrays.
When to use
Use when constructing or inspecting AST nodes for tuple or array-like schemas, including rest elements.
Details
elements— positional element types (tuple elements). An element is optional if its Context.isOptional istrue.rest— the rest/variadic element types. When non-empty, the first entry is the "spread" type (e.g....Array<string>), and subsequent entries are trailing positional elements after the spread.isMutable— whether the resulting array isreadonly(false) or mutable (true).
Gotchas
Construction enforces TypeScript ordering rules: a required element cannot follow an optional one, and an optional element cannot follow a rest element.
Example (Inspecting a tuple AST)
import { Schema, SchemaAST } from "effect"
const schema = Schema.Tuple([Schema.String, Schema.Number])
const ast = schema.ast
if (SchemaAST.isArrays(ast)) {
console.log(ast.elements.length) // 2
console.log(ast.rest.length) // 0
}export class class Arraysclass Arrays {
_tag: 'Arrays';
isMutable: boolean;
elements: ReadonlyArray<AST>;
rest: ReadonlyArray<AST>;
encodingChecks: Checks | undefined;
getParser: (recur: (ast: AST) => SchemaParser.Parser) => SchemaParser.Parser;
_rebuild: (recur: (ast: AST) => AST, checks: Checks | undefined, encodingChecks: Checks | undefined) => Arrays;
recur: (recur: (ast: AST) => AST) => Arrays;
flip: (recur: (ast: AST) => AST) => Arrays;
getExpected: () => string;
annotations: Schema.Annotations.Annotations | undefined;
checks: Checks | undefined;
encoding: Encoding | undefined;
context: Context | undefined;
toString: () => string;
}
AST node for array-like types — both tuples and arrays.
When to use
Use when constructing or inspecting AST nodes for tuple or array-like schemas,
including rest elements.
Details
elements — positional element types (tuple elements). An element is
optional if its
Context.isOptional
is true.
rest — the rest/variadic element types. When non-empty, the first
entry is the "spread" type (e.g. ...Array<string>), and subsequent
entries are trailing positional elements after the spread.
isMutable — whether the resulting array is readonly (false) or
mutable (true).
Gotchas
Construction enforces TypeScript ordering rules: a required element
cannot follow an optional one, and an optional element cannot follow a
rest element.
Example (Inspecting a tuple AST)
import { Schema, SchemaAST } from "effect"
const schema = Schema.Tuple([Schema.String, Schema.Number])
const ast = schema.ast
if (SchemaAST.isArrays(ast)) {
console.log(ast.elements.length) // 2
console.log(ast.rest.length) // 0
}
Arrays extends class 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.
Base {
readonly Arrays._tag: "Arrays"_tag = "Arrays"
readonly Arrays.isMutable: booleanisMutable: boolean
readonly Arrays.elements: ReadonlyArray<AST>elements: interface ReadonlyArray<T>ReadonlyArray<type AST =
| Declaration
| Null
| Undefined
| Void
| Never
| Unknown
| Any
| String
| Number
| Boolean
| BigInt
| Symbol
| Literal
| UniqueSymbol
| ObjectKeyword
| Enum
| TemplateLiteral
| Arrays
| Objects
| Union<AST>
| Suspend
Discriminated union of all AST node types.
Details
Every Schema has an .ast property of this type. Use the guard functions
(
isString
,
isObjects
, etc.) to narrow to a specific variant,
then access variant-specific fields.
- All variants share the
Base
fields:
annotations, checks,
encoding, context.
- Discriminate on the
_tag field (e.g. "String", "Objects", "Union").
AST>
readonly Arrays.rest: ReadonlyArray<AST>rest: interface ReadonlyArray<T>ReadonlyArray<type AST =
| Declaration
| Null
| Undefined
| Void
| Never
| Unknown
| Any
| String
| Number
| Boolean
| BigInt
| Symbol
| Literal
| UniqueSymbol
| ObjectKeyword
| Enum
| TemplateLiteral
| Arrays
| Objects
| Union<AST>
| Suspend
Discriminated union of all AST node types.
Details
Every Schema has an .ast property of this type. Use the guard functions
(
isString
,
isObjects
, etc.) to narrow to a specific variant,
then access variant-specific fields.
- All variants share the
Base
fields:
annotations, checks,
encoding, context.
- Discriminate on the
_tag field (e.g. "String", "Objects", "Union").
AST>
readonly Arrays.encodingChecks: Checks | undefinedencodingChecks: 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
constructor(
isMutable: booleanisMutable: boolean,
elements: ReadonlyArray<AST>elements: interface ReadonlyArray<T>ReadonlyArray<type AST =
| Declaration
| Null
| Undefined
| Void
| Never
| Unknown
| Any
| String
| Number
| Boolean
| BigInt
| Symbol
| Literal
| UniqueSymbol
| ObjectKeyword
| Enum
| TemplateLiteral
| Arrays
| Objects
| Union<AST>
| Suspend
Discriminated union of all AST node types.
Details
Every Schema has an .ast property of this type. Use the guard functions
(
isString
,
isObjects
, etc.) to narrow to a specific variant,
then access variant-specific fields.
- All variants share the
Base
fields:
annotations, checks,
encoding, context.
- Discriminate on the
_tag field (e.g. "String", "Objects", "Union").
AST>,
rest: ReadonlyArray<AST>rest: interface ReadonlyArray<T>ReadonlyArray<type AST =
| Declaration
| Null
| Undefined
| Void
| Never
| Unknown
| Any
| String
| Number
| Boolean
| BigInt
| Symbol
| Literal
| UniqueSymbol
| ObjectKeyword
| Enum
| TemplateLiteral
| Arrays
| Objects
| Union<AST>
| Suspend
Discriminated union of all AST node types.
Details
Every Schema has an .ast property of this type. Use the guard functions
(
isString
,
isObjects
, etc.) to narrow to a specific variant,
then access variant-specific fields.
- All variants share the
Base
fields:
annotations, checks,
encoding, context.
- Discriminate on the
_tag field (e.g. "String", "Objects", "Union").
AST>,
annotations: anyannotations?: import SchemaSchema.declareAnnotations.type Schema.Annotations.Annotations = /*unresolved*/ anyAnnotations,
checks: Checkschecks?: 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,
encoding: Encodingencoding?: 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,
context: Contextcontext?: 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,
encodingChecks: ChecksencodingChecks?: 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
) {
super(annotations: anyannotations, checks: Checkschecks, encoding: Encodingencoding, context: Contextcontext)
this.Arrays.isMutable: booleanisMutable = isMutable: booleanisMutable
this.Arrays.elements: ReadonlyArray<AST>elements = elements: ReadonlyArray<AST>elements
this.Arrays.rest: ReadonlyArray<AST>rest = rest: ReadonlyArray<AST>rest
this.Arrays.encodingChecks: Checks | undefinedencodingChecks = encodingChecks: ChecksencodingChecks
// A required element cannot follow an optional element. ts(1257)
const const i: numberi = elements: ReadonlyArray<AST>elements.ReadonlyArray<AST>.findIndex(predicate: (value: AST, index: number, obj: readonly AST[]) => unknown, thisArg?: any): numberReturns the index of the first element in the array where predicate is true, and -1
otherwise.
findIndex(function isOptional(ast: AST): booleanReturns true if the AST node represents an optional property.
Details
Checks ast.context?.isOptional. Defaults to false when no
Context
is set.
isOptional)
if (const i: numberi !== -1 && (elements: ReadonlyArray<AST>elements.ReadonlyArray<AST>.slice(start?: number, end?: number): AST[]Returns a section of an array.
slice(const i: numberi + 1).Array<AST>.some(predicate: (value: AST, index: number, array: AST[]) => unknown, thisArg?: any): booleanDetermines whether the specified callback function returns true for any element of an array.
some((e: ASTe) => !function isOptional(ast: AST): booleanReturns true if the AST node represents an optional property.
Details
Checks ast.context?.isOptional. Defaults to false when no
Context
is set.
isOptional(e: ASTe)) || rest: ReadonlyArray<AST>rest.ReadonlyArray<AST>.length: numberGets the length of the array. This is a number one higher than the highest element defined in an array.
length > 1)) {
throw new var Error: ErrorConstructor
new (message?: string, options?: ErrorOptions) => Error (+1 overload)
Error("A required element cannot follow an optional element. ts(1257)")
}
// An optional element cannot follow a rest element.ts(1266)
if (rest: ReadonlyArray<AST>rest.ReadonlyArray<AST>.length: numberGets the length of the array. This is a number one higher than the highest element defined in an array.
length > 1 && rest: ReadonlyArray<AST>rest.ReadonlyArray<AST>.slice(start?: number, end?: number): AST[]Returns a section of an array.
slice(1).Array<AST>.some(predicate: (value: AST, index: number, array: AST[]) => unknown, thisArg?: any): booleanDetermines whether the specified callback function returns true for any element of an array.
some(function isOptional(ast: AST): booleanReturns true if the AST node represents an optional property.
Details
Checks ast.context?.isOptional. Defaults to false when no
Context
is set.
isOptional)) {
throw new var Error: ErrorConstructor
new (message?: string, options?: ErrorOptions) => Error (+1 overload)
Error("An optional element cannot follow a rest element. ts(1266)")
}
}
/** @internal */
Arrays.getParser(recur: (ast: AST) => SchemaParser.Parser): SchemaParser.ParsergetParser(recur: (ast: AST) => SchemaParser.Parserrecur: (ast: ASTast: type AST =
| Declaration
| Null
| Undefined
| Void
| Never
| Unknown
| Any
| String
| Number
| Boolean
| BigInt
| Symbol
| Literal
| UniqueSymbol
| ObjectKeyword
| Enum
| TemplateLiteral
| Arrays
| Objects
| Union<AST>
| Suspend
Discriminated union of all AST node types.
Details
Every Schema has an .ast property of this type. Use the guard functions
(
isString
,
isObjects
, etc.) to narrow to a specific variant,
then access variant-specific fields.
- All variants share the
Base
fields:
annotations, checks,
encoding, context.
- Discriminate on the
_tag field (e.g. "String", "Objects", "Union").
AST) => import SchemaParserSchemaParser.Parser): import SchemaParserSchemaParser.Parser {
// oxlint-disable-next-line @typescript-eslint/no-this-alias
const const ast: thisast = this
const const elements: {
ast: AST
parser: SchemaParser.Parser
}[]
elements = const ast: thisast.Arrays.elements: ReadonlyArray<AST>elements.ReadonlyArray<AST>.map<{
ast: AST;
parser: SchemaParser.Parser;
}>(callbackfn: (value: AST, index: number, array: readonly AST[]) => {
ast: AST;
parser: SchemaParser.Parser;
}, thisArg?: any): {
ast: AST;
parser: SchemaParser.Parser;
}[]
Calls a defined callback function on each element of an array, and returns an array that contains the results.
map((ast: ASTast) => ({ ast: ASTast, parser: SchemaParser.Parserparser: recur: (ast: AST) => SchemaParser.Parserrecur(ast: ASTast) }))
const const rest: {
ast: AST
parser: SchemaParser.Parser
}[]
rest = const ast: thisast.Arrays.rest: ReadonlyArray<AST>rest.ReadonlyArray<AST>.map<{
ast: AST;
parser: SchemaParser.Parser;
}>(callbackfn: (value: AST, index: number, array: readonly AST[]) => {
ast: AST;
parser: SchemaParser.Parser;
}, thisArg?: any): {
ast: AST;
parser: SchemaParser.Parser;
}[]
Calls a defined callback function on each element of an array, and returns an array that contains the results.
map((ast: ASTast) => ({ ast: ASTast, parser: SchemaParser.Parserparser: recur: (ast: AST) => SchemaParser.Parserrecur(ast: ASTast) }))
const const elementLen: numberelementLen = const elements: {
ast: AST
parser: SchemaParser.Parser
}[]
elements.Array<{ ast: AST; parser: Parser; }>.length: numberGets or sets the length of the array. This is a number one higher than the highest index in the array.
length
const [const head: {
ast: AST
parser: SchemaParser.Parser
}
head, ...const tail: {
ast: AST
parser: SchemaParser.Parser
}[]
tail] = const rest: {
ast: AST
parser: SchemaParser.Parser
}[]
rest
const const tailLen: numbertailLen = const tail: {
ast: AST
parser: SchemaParser.Parser
}[]
tail.Array<T>.length: numberGets or sets the length of the array. This is a number one higher than the highest index in the array.
length
function function (local function) getParser(tailThreshold: number, index: number): { readonly ast: AST; readonly parser: SchemaParser.Parser }getParser(
tailThreshold: numbertailThreshold: number,
index: numberindex: number
): { readonly ast: ASTast: type AST =
| Declaration
| Null
| Undefined
| Void
| Never
| Unknown
| Any
| String
| Number
| Boolean
| BigInt
| Symbol
| Literal
| UniqueSymbol
| ObjectKeyword
| Enum
| TemplateLiteral
| Arrays
| Objects
| Union<AST>
| Suspend
Discriminated union of all AST node types.
Details
Every Schema has an .ast property of this type. Use the guard functions
(
isString
,
isObjects
, etc.) to narrow to a specific variant,
then access variant-specific fields.
- All variants share the
Base
fields:
annotations, checks,
encoding, context.
- Discriminate on the
_tag field (e.g. "String", "Objects", "Union").
AST; readonly parser: SchemaParser.Parserparser: import SchemaParserSchemaParser.Parser } {
if (index: numberindex < const elementLen: numberelementLen) {
return const elements: {
ast: AST
parser: SchemaParser.Parser
}[]
elements[index: numberindex]
} else if (index: numberindex >= tailThreshold: numbertailThreshold) {
return const tail: {
ast: AST
parser: SchemaParser.Parser
}[]
tail[index: numberindex - tailThreshold: numbertailThreshold]
}
return const head: {
ast: AST
parser: SchemaParser.Parser
}
head
}
return import EffectEffect.fnUntracedEager(function*(oinput: Option.Option<unknown>oinput, options: ParseOptions(parameter) options: {
errors: "first" | "all" | undefined;
onExcessProperty: "ignore" | "error" | "preserve" | undefined;
propertyOrder: "none" | "original" | undefined;
disableChecks: boolean | undefined;
concurrency: number | "unbounded" | undefined;
}
options) {
if (oinput: Option.Option<unknown>oinput._tag === "None") {
return oinput: Option.None<unknown>(parameter) oinput: {
_tag: "None";
_op: "None";
valueOrUndefined: undefined;
pipe: { <A>(this: A): A; <A, B = never>(this: A, ab: (_: A) => B): B; <A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C; <A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D; <…;
toString: () => string;
toJSON: () => unknown;
}
oinput
}
const const input: anyinput = oinput: Option.Some<unknown>(parameter) oinput: {
_tag: "Some";
_op: "Some";
value: A;
valueOrUndefined: A;
pipe: { <A>(this: A): A; <A, B = never>(this: A, ab: (_: A) => B): B; <A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C; <A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D; <…;
toString: () => string;
toJSON: () => unknown;
}
oinput.value
// If the input is not an array, return early with an error
if (!var Array: ArrayConstructorArray.ArrayConstructor.isArray(arg: any): arg is any[]isArray(const input: anyinput)) {
return yield* import EffectEffect.fail(new import SchemaIssueSchemaIssue.constructor InvalidType(ast: AST, actual: Option.Option<unknown>): SchemaIssue.InvalidTypeRepresents a schema issue produced when the runtime type of the input does not match the type
expected by the schema (e.g. got null when string was expected).
When to use
Use when you need to detect basic type mismatches, such as a wrong primitive
or null where an object was expected.
Details
ast is the schema node that expected a different type.
actual is Option.some(value) when the input was present, or
Option.none() when no value was provided.
- The default formatter renders this as
"Expected <type>, got <actual>".
Example (Formatting output)
import { Schema } from "effect"
try {
Schema.decodeUnknownSync(Schema.String)(42)
} catch (e) {
if (Schema.isSchemaError(e)) {
console.log(String(e.issue))
// "Expected string, got 42"
}
}
InvalidType(const ast: thisast, oinput: Option.Some<unknown>(parameter) oinput: {
_tag: "Some";
_op: "Some";
value: A;
valueOrUndefined: A;
pipe: { <A>(this: A): A; <A, B = never>(this: A, ab: (_: A) => B): B; <A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C; <A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D; <…;
toString: () => string;
toJSON: () => unknown;
}
oinput))
}
const const len: numberlen = const input: any[]input.Array<T>.length: numberGets or sets the length of the array. This is a number one higher than the highest index in the array.
length
const const state: {
ast: this
getParser: (
tailThreshold: number,
index: number
) => {
readonly ast: AST
readonly parser: SchemaParser.Parser
}
oinput: any
len: number
tailThreshold: number
output: any[]
issues:
| Arr.NonEmptyArray<SchemaIssue.Issue>
| undefined
options: any
}
state = {
ast: thisast,
getParser: (
tailThreshold: number,
index: number
) => {
readonly ast: AST
readonly parser: SchemaParser.Parser
}
getParser,
oinput: Option.Some<unknown>(property) oinput: {
_tag: "Some";
_op: "Some";
value: A;
valueOrUndefined: A;
pipe: { <A>(this: A): A; <A, B = never>(this: A, ab: (_: A) => B): B; <A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C; <A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D; <…;
toString: () => string;
toJSON: () => unknown;
}
oinput,
len: numberlen,
tailThreshold: numbertailThreshold: function resolveTailThreshold(
inputLen: number,
elementLen: number,
tailLen: number
): number
resolveTailThreshold(const len: numberlen, const elementLen: numberelementLen, const tailLen: numbertailLen),
output: any[]output: new module globalThisglobalThis.var Array: ArrayConstructor
new (arrayLength?: number) => any[] (+2 overloads)
Array(const len: numberlen),
issues: anyissues: var undefinedundefined as import ArrArr.type Arr.NonEmptyArray = /*unresolved*/ anyNonEmptyArray<import SchemaIssueSchemaIssue.type Issue =
| SchemaIssue.Leaf
| SchemaIssue.Filter
| SchemaIssue.Encoding
| SchemaIssue.Pointer
| SchemaIssue.Composite
| SchemaIssue.AnyOf
The root discriminated union of all validation error nodes.
When to use
Use when typing the error channel in Effect<A, Issue, R> results from
schema parsing, or when writing custom formatters or issue-tree walkers.
Details
Every node has a _tag field for pattern-matching. The union includes both
terminal
Leaf
types and composite types that wrap inner issues:
Filter
,
Encoding
,
Pointer
,
Composite
,
AnyOf
. All Issue instances have a toString() that delegates to
the default formatter, so String(issue) produces a human-readable message.
Issue> | undefined,
options: ParseOptions(property) options: {
errors: "first" | "all" | undefined;
onExcessProperty: "ignore" | "error" | "preserve" | undefined;
propertyOrder: "none" | "original" | undefined;
disableChecks: boolean | undefined;
concurrency: number | "unbounded" | undefined;
}
options
}
const const concurrency:
| {
concurrency: number
}
| undefined
concurrency = const resolveConcurrency: (
value: number | "unbounded" | undefined
) =>
| {
concurrency: number
}
| undefined
resolveConcurrency(options: ParseOptions(parameter) options: {
errors: "first" | "all" | undefined;
onExcessProperty: "ignore" | "error" | "preserve" | undefined;
propertyOrder: "none" | "original" | undefined;
disableChecks: boolean | undefined;
concurrency: number | "unbounded" | undefined;
}
options?.concurrency)
const const eff: anyeff = const parseArray: (
initialState: {
readonly ast: AST
readonly oinput: Option.Option<unknown>
readonly len: number
readonly getParser: (
tailThreshold: number,
index: number
) => {
readonly ast: AST
readonly parser: SchemaParser.Parser
}
readonly tailThreshold: number
readonly options: ParseOptions
readonly output: Array<unknown>
issues: Array<SchemaIssue.Issue> | undefined
},
items: ReadonlyArray<unknown>,
options?: IterateEagerOptions
) =>
| Effect.Effect<void, SchemaIssue.Issue, any>
| undefined
parseArray(const state: {
ast: this
getParser: (
tailThreshold: number,
index: number
) => {
readonly ast: AST
readonly parser: SchemaParser.Parser
}
oinput: any
len: number
tailThreshold: number
output: any[]
issues:
| Arr.NonEmptyArray<SchemaIssue.Issue>
| undefined
options: any
}
state, const input: any[]input, {
concurrency?: number | undefinedconcurrency: const concurrency:
| {
concurrency: number
}
| undefined
concurrency?.concurrency: number | undefinedconcurrency,
end?: number | undefinedend: const ast: thisast.Arrays.rest: ReadonlyArray<AST>rest.ReadonlyArray<AST>.length: numberGets the length of the array. This is a number one higher than the highest element defined in an array.
length === 0 ? const elementLen: numberelementLen : var Math: MathAn intrinsic object that provides basic mathematics functionality and constants.
Math.Math.max(...values: number[]): numberReturns the larger of a set of supplied numeric expressions.
max(const len: numberlen, const elementLen: numberelementLen + const tailLen: numbertailLen)
})
if (const eff: anyeff) yield* const eff: Effect.Effect<
void,
SchemaIssue.Issue,
any
>
const eff: {
pipe: { <A>(this: A): A; <A, B = never>(this: A, ab: (_: A) => B): B; <A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C; <A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D; <…;
toString: () => string;
toJSON: () => unknown;
}
eff
// ---------------------------------------------
// handle excess indexes
// ---------------------------------------------
if (const ast: thisast.Arrays.rest: ReadonlyArray<AST>rest.ReadonlyArray<AST>.length: numberGets the length of the array. This is a number one higher than the highest element defined in an array.
length === 0 && const len: numberlen > const elementLen: numberelementLen) {
for (let let i: numberi = const elementLen: numberelementLen; let i: numberi <= const len: numberlen - 1; let i: numberi++) {
const const issue: SchemaIssue.Pointerconst issue: {
_tag: 'Pointer';
path: ReadonlyArray<PropertyKey>;
issue: Issue;
toString: (this: Issue) => string;
}
issue = new import SchemaIssueSchemaIssue.constructor Pointer(path: ReadonlyArray<PropertyKey>, issue: SchemaIssue.Issue): SchemaIssue.PointerWraps an inner
Issue
with a property-key path, indicating where in
a nested structure the error occurred.
When to use
Use when you need to walk the issue tree to accumulate path segments for error
reporting.
Details
path is an array of property keys (strings, numbers, or symbols).
- Has no
actual value —
getActual
returns Option.none().
- Formatters concatenate nested
Pointer paths into a single path like
["a"]["b"][0].
Pointer([let i: numberi], new import SchemaIssueSchemaIssue.constructor UnexpectedKey(ast: AST, actual: unknown): SchemaIssue.UnexpectedKeyRepresents a schema issue produced when an input object or tuple contains a key/index not
declared by the schema.
When to use
Use when you need to detect excess properties during strict struct/tuple
validation.
Details
actual is the raw value at the unexpected key (plain unknown).
ast is the schema that was being validated against.
annotations on ast may contain a custom messageUnexpectedKey.
UnexpectedKey(const ast: thisast, const input: any[]input[let i: numberi]))
if (options: ParseOptions(parameter) options: {
errors: "first" | "all" | undefined;
onExcessProperty: "ignore" | "error" | "preserve" | undefined;
propertyOrder: "none" | "original" | undefined;
disableChecks: boolean | undefined;
concurrency: number | "unbounded" | undefined;
}
options.errors === "all") {
if (const state: {
ast: this
getParser: (
tailThreshold: number,
index: number
) => {
readonly ast: AST
readonly parser: SchemaParser.Parser
}
oinput: any
len: number
tailThreshold: number
output: any[]
issues:
| Arr.NonEmptyArray<SchemaIssue.Issue>
| undefined
options: any
}
state.issues: anyissues) const state: {
ast: this
getParser: (
tailThreshold: number,
index: number
) => {
readonly ast: AST
readonly parser: SchemaParser.Parser
}
oinput: any
len: number
tailThreshold: number
output: any[]
issues:
| Arr.NonEmptyArray<SchemaIssue.Issue>
| undefined
options: any
}
state.issues: any(property) issues: {
0: SchemaIssue.Issue;
length: number;
toString: () => string;
toLocaleString: { (): string; (locales: string | string[], options?: Intl.NumberFormatOptions & Intl.DateTimeFormatOptions): string };
pop: () => SchemaIssue.Issue | undefined;
push: (...items: Array<SchemaIssue.Issue>) => number;
concat: { (...items: Array<ConcatArray<SchemaIssue.Issue>>): Array<SchemaIssue.Issue>; (...items: Array<SchemaIssue.Issue | ConcatArray<SchemaIssue.Issue>>): Array<SchemaIssue.Issue> };
join: (separator?: string) => string;
reverse: () => Array<SchemaIssue.Issue>;
shift: () => SchemaIssue.Issue | undefined;
slice: (start?: number, end?: number) => Array<SchemaIssue.Issue>;
sort: (compareFn?: ((a: SchemaIssue.Issue, b: SchemaIssue.Issue) => number) | undefined) => [SchemaIssue.Issue, ...SchemaIssue.Issue[]];
splice: { (start: number, deleteCount?: number): Array<SchemaIssue.Issue>; (start: number, deleteCount: number, ...items: Array<SchemaIssue.Issue>): Array<SchemaIssue.Issue> };
unshift: (...items: Array<SchemaIssue.Issue>) => number;
indexOf: (searchElement: SchemaIssue.Issue, fromIndex?: number) => number;
lastIndexOf: (searchElement: SchemaIssue.Issue, fromIndex?: number) => number;
every: { (predicate: (value: SchemaIssue.Issue, index: number, array: Array<SchemaIssue.Issue>) => value is S, thisArg?: any): this is S[]; (predicate: (value: SchemaIssue.Issue, index: number, array: Array<SchemaIssue.Issue>) => unknown, thisArg…;
some: (predicate: (value: SchemaIssue.Issue, index: number, array: Array<SchemaIssue.Issue>) => unknown, thisArg?: any) => boolean;
forEach: (callbackfn: (value: SchemaIssue.Issue, index: number, array: Array<SchemaIssue.Issue>) => void, thisArg?: any) => void;
map: (callbackfn: (value: SchemaIssue.Issue, index: number, array: Array<SchemaIssue.Issue>) => U, thisArg?: any) => Array<U>;
filter: { (predicate: (value: SchemaIssue.Issue, index: number, array: Array<SchemaIssue.Issue>) => value is S, thisArg?: any): Array<S>; (predicate: (value: SchemaIssue.Issue, index: number, array: Array<SchemaIssue.Issue>) => unknown, thisArg?: …;
reduce: { (callbackfn: (previousValue: SchemaIssue.Issue, currentValue: SchemaIssue.Issue, currentIndex: number, array: Array<SchemaIssue.Issue>) => SchemaIssue.Issue): SchemaIssue.Issue; (callbackfn: (previousValue: SchemaIssue.Issue, currentValu…;
reduceRight: { (callbackfn: (previousValue: SchemaIssue.Issue, currentValue: SchemaIssue.Issue, currentIndex: number, array: Array<SchemaIssue.Issue>) => SchemaIssue.Issue): SchemaIssue.Issue; (callbackfn: (previousValue: SchemaIssue.Issue, currentValu…;
find: { (predicate: (value: SchemaIssue.Issue, index: number, obj: Array<SchemaIssue.Issue>) => value is S, thisArg?: any): S | undefined; (predicate: (value: SchemaIssue.Issue, index: number, obj: Array<SchemaIssue.Issue>) => unknown, thisArg?:…;
findIndex: (predicate: (value: SchemaIssue.Issue, index: number, obj: Array<SchemaIssue.Issue>) => unknown, thisArg?: any) => number;
fill: (value: SchemaIssue.Issue, start?: number, end?: number) => [SchemaIssue.Issue, ...SchemaIssue.Issue[]];
copyWithin: (target: number, start: number, end?: number) => [SchemaIssue.Issue, ...SchemaIssue.Issue[]];
entries: () => ArrayIterator<[number, SchemaIssue.Issue]>;
keys: () => ArrayIterator<number>;
values: () => ArrayIterator<SchemaIssue.Issue>;
includes: (searchElement: SchemaIssue.Issue, fromIndex?: number) => boolean;
flatMap: (callback: (this: This, value: SchemaIssue.Issue, index: number, array: Array<SchemaIssue.Issue>) => U | ReadonlyArray<U>, thisArg?: This | undefined) => Array<U>;
flat: (this: A, depth?: D | undefined) => Array<FlatArray<A, D>>;
at: (index: number) => SchemaIssue.Issue | undefined;
findLast: { (predicate: (value: SchemaIssue.Issue, index: number, array: Array<SchemaIssue.Issue>) => value is S, thisArg?: any): S | undefined; (predicate: (value: SchemaIssue.Issue, index: number, array: Array<SchemaIssue.Issue>) => unknown, thisA…;
findLastIndex: (predicate: (value: SchemaIssue.Issue, index: number, array: Array<SchemaIssue.Issue>) => unknown, thisArg?: any) => number;
toReversed: () => Array<SchemaIssue.Issue>;
toSorted: (compareFn?: ((a: SchemaIssue.Issue, b: SchemaIssue.Issue) => number) | undefined) => Array<SchemaIssue.Issue>;
toSpliced: { (start: number, deleteCount: number, ...items: Array<SchemaIssue.Issue>): Array<SchemaIssue.Issue>; (start: number, deleteCount?: number): Array<SchemaIssue.Issue> };
with: (index: number, value: SchemaIssue.Issue) => Array<SchemaIssue.Issue>;
}
issues.push(const issue: SchemaIssue.Pointerconst issue: {
_tag: 'Pointer';
path: ReadonlyArray<PropertyKey>;
issue: Issue;
toString: (this: Issue) => string;
}
issue)
else const state: {
ast: this
getParser: (
tailThreshold: number,
index: number
) => {
readonly ast: AST
readonly parser: SchemaParser.Parser
}
oinput: any
len: number
tailThreshold: number
output: any[]
issues:
| Arr.NonEmptyArray<SchemaIssue.Issue>
| undefined
options: any
}
state.issues: anyissues = [const issue: SchemaIssue.Pointerconst issue: {
_tag: 'Pointer';
path: ReadonlyArray<PropertyKey>;
issue: Issue;
toString: (this: Issue) => string;
}
issue]
} else {
return yield* import EffectEffect.fail(new import SchemaIssueSchemaIssue.constructor Composite(ast: AST, actual: Option.Option<unknown>, issues: readonly [SchemaIssue.Issue, ...Array<SchemaIssue.Issue>]): SchemaIssue.CompositeRepresents a schema issue that groups multiple child issues under a single schema node.
When to use
Use when you need to walk the issue tree for struct/tuple schemas that collect
all field errors rather than failing on the first.
Details
issues is a non-empty readonly array (at least one child).
actual is Option.some(value) when the input was present, or
Option.none() when absent.
- Formatters flatten
Composite by recursing into each child.
Composite(const ast: thisast, oinput: Option.Some<unknown>(parameter) oinput: {
_tag: "Some";
_op: "Some";
value: A;
valueOrUndefined: A;
pipe: { <A>(this: A): A; <A, B = never>(this: A, ab: (_: A) => B): B; <A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C; <A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D; <…;
toString: () => string;
toJSON: () => unknown;
}
oinput, [const issue: SchemaIssue.Pointerconst issue: {
_tag: 'Pointer';
path: ReadonlyArray<PropertyKey>;
issue: Issue;
toString: (this: Issue) => string;
}
issue]))
}
}
}
if (const state: {
ast: this
getParser: (
tailThreshold: number,
index: number
) => {
readonly ast: AST
readonly parser: SchemaParser.Parser
}
oinput: any
len: number
tailThreshold: number
output: any[]
issues:
| Arr.NonEmptyArray<SchemaIssue.Issue>
| undefined
options: any
}
state.issues: anyissues) {
return yield* import EffectEffect.fail(new import SchemaIssueSchemaIssue.constructor Composite(ast: AST, actual: Option.Option<unknown>, issues: readonly [SchemaIssue.Issue, ...Array<SchemaIssue.Issue>]): SchemaIssue.CompositeRepresents a schema issue that groups multiple child issues under a single schema node.
When to use
Use when you need to walk the issue tree for struct/tuple schemas that collect
all field errors rather than failing on the first.
Details
issues is a non-empty readonly array (at least one child).
actual is Option.some(value) when the input was present, or
Option.none() when absent.
- Formatters flatten
Composite by recursing into each child.
Composite(const ast: thisast, oinput: Option.Some<unknown>(parameter) oinput: {
_tag: "Some";
_op: "Some";
value: A;
valueOrUndefined: A;
pipe: { <A>(this: A): A; <A, B = never>(this: A, ab: (_: A) => B): B; <A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C; <A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D; <…;
toString: () => string;
toJSON: () => unknown;
}
oinput, const state: {
ast: this
getParser: (
tailThreshold: number,
index: number
) => {
readonly ast: AST
readonly parser: SchemaParser.Parser
}
oinput: any
len: number
tailThreshold: number
output: any[]
issues:
| Arr.NonEmptyArray<SchemaIssue.Issue>
| undefined
options: any
}
state.issues: any(property) issues: {
0: SchemaIssue.Issue;
length: number;
toString: () => string;
toLocaleString: { (): string; (locales: string | string[], options?: Intl.NumberFormatOptions & Intl.DateTimeFormatOptions): string };
pop: () => SchemaIssue.Issue | undefined;
push: (...items: Array<SchemaIssue.Issue>) => number;
concat: { (...items: Array<ConcatArray<SchemaIssue.Issue>>): Array<SchemaIssue.Issue>; (...items: Array<SchemaIssue.Issue | ConcatArray<SchemaIssue.Issue>>): Array<SchemaIssue.Issue> };
join: (separator?: string) => string;
reverse: () => Array<SchemaIssue.Issue>;
shift: () => SchemaIssue.Issue | undefined;
slice: (start?: number, end?: number) => Array<SchemaIssue.Issue>;
sort: (compareFn?: ((a: SchemaIssue.Issue, b: SchemaIssue.Issue) => number) | undefined) => [SchemaIssue.Issue, ...SchemaIssue.Issue[]];
splice: { (start: number, deleteCount?: number): Array<SchemaIssue.Issue>; (start: number, deleteCount: number, ...items: Array<SchemaIssue.Issue>): Array<SchemaIssue.Issue> };
unshift: (...items: Array<SchemaIssue.Issue>) => number;
indexOf: (searchElement: SchemaIssue.Issue, fromIndex?: number) => number;
lastIndexOf: (searchElement: SchemaIssue.Issue, fromIndex?: number) => number;
every: { (predicate: (value: SchemaIssue.Issue, index: number, array: Array<SchemaIssue.Issue>) => value is S, thisArg?: any): this is S[]; (predicate: (value: SchemaIssue.Issue, index: number, array: Array<SchemaIssue.Issue>) => unknown, thisArg…;
some: (predicate: (value: SchemaIssue.Issue, index: number, array: Array<SchemaIssue.Issue>) => unknown, thisArg?: any) => boolean;
forEach: (callbackfn: (value: SchemaIssue.Issue, index: number, array: Array<SchemaIssue.Issue>) => void, thisArg?: any) => void;
map: (callbackfn: (value: SchemaIssue.Issue, index: number, array: Array<SchemaIssue.Issue>) => U, thisArg?: any) => Array<U>;
filter: { (predicate: (value: SchemaIssue.Issue, index: number, array: Array<SchemaIssue.Issue>) => value is S, thisArg?: any): Array<S>; (predicate: (value: SchemaIssue.Issue, index: number, array: Array<SchemaIssue.Issue>) => unknown, thisArg?: …;
reduce: { (callbackfn: (previousValue: SchemaIssue.Issue, currentValue: SchemaIssue.Issue, currentIndex: number, array: Array<SchemaIssue.Issue>) => SchemaIssue.Issue): SchemaIssue.Issue; (callbackfn: (previousValue: SchemaIssue.Issue, currentValu…;
reduceRight: { (callbackfn: (previousValue: SchemaIssue.Issue, currentValue: SchemaIssue.Issue, currentIndex: number, array: Array<SchemaIssue.Issue>) => SchemaIssue.Issue): SchemaIssue.Issue; (callbackfn: (previousValue: SchemaIssue.Issue, currentValu…;
find: { (predicate: (value: SchemaIssue.Issue, index: number, obj: Array<SchemaIssue.Issue>) => value is S, thisArg?: any): S | undefined; (predicate: (value: SchemaIssue.Issue, index: number, obj: Array<SchemaIssue.Issue>) => unknown, thisArg?:…;
findIndex: (predicate: (value: SchemaIssue.Issue, index: number, obj: Array<SchemaIssue.Issue>) => unknown, thisArg?: any) => number;
fill: (value: SchemaIssue.Issue, start?: number, end?: number) => [SchemaIssue.Issue, ...SchemaIssue.Issue[]];
copyWithin: (target: number, start: number, end?: number) => [SchemaIssue.Issue, ...SchemaIssue.Issue[]];
entries: () => ArrayIterator<[number, SchemaIssue.Issue]>;
keys: () => ArrayIterator<number>;
values: () => ArrayIterator<SchemaIssue.Issue>;
includes: (searchElement: SchemaIssue.Issue, fromIndex?: number) => boolean;
flatMap: (callback: (this: This, value: SchemaIssue.Issue, index: number, array: Array<SchemaIssue.Issue>) => U | ReadonlyArray<U>, thisArg?: This | undefined) => Array<U>;
flat: (this: A, depth?: D | undefined) => Array<FlatArray<A, D>>;
at: (index: number) => SchemaIssue.Issue | undefined;
findLast: { (predicate: (value: SchemaIssue.Issue, index: number, array: Array<SchemaIssue.Issue>) => value is S, thisArg?: any): S | undefined; (predicate: (value: SchemaIssue.Issue, index: number, array: Array<SchemaIssue.Issue>) => unknown, thisA…;
findLastIndex: (predicate: (value: SchemaIssue.Issue, index: number, array: Array<SchemaIssue.Issue>) => unknown, thisArg?: any) => number;
toReversed: () => Array<SchemaIssue.Issue>;
toSorted: (compareFn?: ((a: SchemaIssue.Issue, b: SchemaIssue.Issue) => number) | undefined) => Array<SchemaIssue.Issue>;
toSpliced: { (start: number, deleteCount: number, ...items: Array<SchemaIssue.Issue>): Array<SchemaIssue.Issue>; (start: number, deleteCount?: number): Array<SchemaIssue.Issue> };
with: (index: number, value: SchemaIssue.Issue) => Array<SchemaIssue.Issue>;
}
issues))
}
return import OptionOption.some(const state: {
ast: this
getParser: (
tailThreshold: number,
index: number
) => {
readonly ast: AST
readonly parser: SchemaParser.Parser
}
oinput: any
len: number
tailThreshold: number
output: any[]
issues:
| Arr.NonEmptyArray<SchemaIssue.Issue>
| undefined
options: any
}
state.output: any[]output)
})
}
private Arrays._rebuild(recur: (ast: AST) => AST, checks: Checks | undefined, encodingChecks: Checks | undefined): Arrays_rebuild(recur: (ast: AST) => ASTrecur: (ast: ASTast: type AST =
| Declaration
| Null
| Undefined
| Void
| Never
| Unknown
| Any
| String
| Number
| Boolean
| BigInt
| Symbol
| Literal
| UniqueSymbol
| ObjectKeyword
| Enum
| TemplateLiteral
| Arrays
| Objects
| Union<AST>
| Suspend
Discriminated union of all AST node types.
Details
Every Schema has an .ast property of this type. Use the guard functions
(
isString
,
isObjects
, etc.) to narrow to a specific variant,
then access variant-specific fields.
- All variants share the
Base
fields:
annotations, checks,
encoding, context.
- Discriminate on the
_tag field (e.g. "String", "Objects", "Union").
AST) => type AST =
| Declaration
| Null
| Undefined
| Void
| Never
| Unknown
| Any
| String
| Number
| Boolean
| BigInt
| Symbol
| Literal
| UniqueSymbol
| ObjectKeyword
| Enum
| TemplateLiteral
| Arrays
| Objects
| Union<AST>
| Suspend
Discriminated union of all AST node types.
Details
Every Schema has an .ast property of this type. Use the guard functions
(
isString
,
isObjects
, etc.) to narrow to a specific variant,
then access variant-specific fields.
- All variants share the
Base
fields:
annotations, checks,
encoding, context.
- Discriminate on the
_tag field (e.g. "String", "Objects", "Union").
AST, 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, encodingChecks: Checks | undefinedencodingChecks: 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) {
const const elements: ReadonlyArray<AST>elements = function mapOrSame<AST>(as: Arr.NonEmptyReadonlyArray<AST>, f: (a: AST) => AST): Arr.NonEmptyReadonlyArray<AST> (+1 overload)Maps over the array but will return the original array if no changes occur.
mapOrSame(this.Arrays.elements: ReadonlyArray<AST>elements, recur: (ast: AST) => ASTrecur)
const const rest: ReadonlyArray<AST>rest = function mapOrSame<AST>(as: Arr.NonEmptyReadonlyArray<AST>, f: (a: AST) => AST): Arr.NonEmptyReadonlyArray<AST> (+1 overload)Maps over the array but will return the original array if no changes occur.
mapOrSame(this.Arrays.rest: ReadonlyArray<AST>rest, recur: (ast: AST) => ASTrecur)
return const elements: ReadonlyArray<AST>elements === this.Arrays.elements: ReadonlyArray<AST>elements && const rest: ReadonlyArray<AST>rest === this.Arrays.rest: ReadonlyArray<AST>rest && checks: Checks | undefinedchecks === this.Base.checks: Checks | undefinedchecks &&
encodingChecks: Checks | undefinedencodingChecks === this.Arrays.encodingChecks: Checks | undefinedencodingChecks ?
this :
new constructor Arrays(isMutable: boolean, elements: ReadonlyArray<AST>, rest: ReadonlyArray<AST>, annotations?: Schema.Annotations.Annotations, checks?: Checks, encoding?: Encoding, context?: Context, encodingChecks?: Checks): ArraysAST node for array-like types — both tuples and arrays.
When to use
Use when constructing or inspecting AST nodes for tuple or array-like schemas,
including rest elements.
Details
elements — positional element types (tuple elements). An element is
optional if its
Context.isOptional
is true.
rest — the rest/variadic element types. When non-empty, the first
entry is the "spread" type (e.g. ...Array<string>), and subsequent
entries are trailing positional elements after the spread.
isMutable — whether the resulting array is readonly (false) or
mutable (true).
Gotchas
Construction enforces TypeScript ordering rules: a required element
cannot follow an optional one, and an optional element cannot follow a
rest element.
Example (Inspecting a tuple AST)
import { Schema, SchemaAST } from "effect"
const schema = Schema.Tuple([Schema.String, Schema.Number])
const ast = schema.ast
if (SchemaAST.isArrays(ast)) {
console.log(ast.elements.length) // 2
console.log(ast.rest.length) // 0
}
Arrays(
this.Arrays.isMutable: booleanisMutable,
const elements: ReadonlyArray<AST>elements,
const rest: ReadonlyArray<AST>rest,
this.Base.annotations: anyannotations,
checks: Checks | undefinedchecks,
var undefinedundefined,
this.Base.context: Context | undefinedcontext,
encodingChecks: Checks | undefinedencodingChecks
)
}
/** @internal */
Arrays.recur(recur: (ast: AST) => AST): Arraysrecur(recur: (ast: AST) => ASTrecur: (ast: ASTast: type AST =
| Declaration
| Null
| Undefined
| Void
| Never
| Unknown
| Any
| String
| Number
| Boolean
| BigInt
| Symbol
| Literal
| UniqueSymbol
| ObjectKeyword
| Enum
| TemplateLiteral
| Arrays
| Objects
| Union<AST>
| Suspend
Discriminated union of all AST node types.
Details
Every Schema has an .ast property of this type. Use the guard functions
(
isString
,
isObjects
, etc.) to narrow to a specific variant,
then access variant-specific fields.
- All variants share the
Base
fields:
annotations, checks,
encoding, context.
- Discriminate on the
_tag field (e.g. "String", "Objects", "Union").
AST) => type AST =
| Declaration
| Null
| Undefined
| Void
| Never
| Unknown
| Any
| String
| Number
| Boolean
| BigInt
| Symbol
| Literal
| UniqueSymbol
| ObjectKeyword
| Enum
| TemplateLiteral
| Arrays
| Objects
| Union<AST>
| Suspend
Discriminated union of all AST node types.
Details
Every Schema has an .ast property of this type. Use the guard functions
(
isString
,
isObjects
, etc.) to narrow to a specific variant,
then access variant-specific fields.
- All variants share the
Base
fields:
annotations, checks,
encoding, context.
- Discriminate on the
_tag field (e.g. "String", "Objects", "Union").
AST) {
return this.Arrays._rebuild(recur: (ast: AST) => AST, checks: Checks | undefined, encodingChecks: Checks | undefined): Arrays_rebuild(recur: (ast: AST) => ASTrecur, this.Base.checks: Checks | undefinedchecks, this.Arrays.encodingChecks: Checks | undefinedencodingChecks)
}
/** @internal */
Arrays.flip(recur: (ast: AST) => AST): Arraysflip(recur: (ast: AST) => ASTrecur: (ast: ASTast: type AST =
| Declaration
| Null
| Undefined
| Void
| Never
| Unknown
| Any
| String
| Number
| Boolean
| BigInt
| Symbol
| Literal
| UniqueSymbol
| ObjectKeyword
| Enum
| TemplateLiteral
| Arrays
| Objects
| Union<AST>
| Suspend
Discriminated union of all AST node types.
Details
Every Schema has an .ast property of this type. Use the guard functions
(
isString
,
isObjects
, etc.) to narrow to a specific variant,
then access variant-specific fields.
- All variants share the
Base
fields:
annotations, checks,
encoding, context.
- Discriminate on the
_tag field (e.g. "String", "Objects", "Union").
AST) => type AST =
| Declaration
| Null
| Undefined
| Void
| Never
| Unknown
| Any
| String
| Number
| Boolean
| BigInt
| Symbol
| Literal
| UniqueSymbol
| ObjectKeyword
| Enum
| TemplateLiteral
| Arrays
| Objects
| Union<AST>
| Suspend
Discriminated union of all AST node types.
Details
Every Schema has an .ast property of this type. Use the guard functions
(
isString
,
isObjects
, etc.) to narrow to a specific variant,
then access variant-specific fields.
- All variants share the
Base
fields:
annotations, checks,
encoding, context.
- Discriminate on the
_tag field (e.g. "String", "Objects", "Union").
AST) {
return this.Arrays._rebuild(recur: (ast: AST) => AST, checks: Checks | undefined, encodingChecks: Checks | undefined): Arrays_rebuild(recur: (ast: AST) => ASTrecur, this.Arrays.encodingChecks: Checks | undefinedencodingChecks, this.Base.checks: Checks | undefinedchecks)
}
/** @internal */
Arrays.getExpected(): stringgetExpected(): string {
return "array"
}
}