$Array<S>Type-level representation returned by Array.
export interface interface $Array<S extends Constraint>Type-level representation returned by
Array
.
$Array<function (type parameter) S in $Array<S extends Constraint>S extends Constraint> extends
interface BottomLazy<out Ast extends SchemaAST.AST, out Rebuild extends Top, in out TypeParameters extends ReadonlyArray<Constraint> = readonly [], out TypeMutability extends Mutability = "readonly", out TypeOptionality extends Optionality = "required", out TypeConstructorDefault extends ConstructorDefault = "no-default", out EncodedMutability extends Mutability = "readonly", out EncodedOptionality extends Optionality = "required">Lazy Bottom variant for schema implementations that compute their public
views on demand.
When to use
Use as an implementation base for schema interfaces that must expose
Bottom behavior without forcing TypeScript to eagerly evaluate expensive
Type, Encoded, or service views.
Details
The laziness is purely type-level; runtime behavior is unchanged.
BottomLazy keeps the structural operations inherited from Bottom, but
erases the expensive schema views to unknown. Concrete schema interfaces can
then redeclare the precise views they expose. This keeps wide schemas such as
Struct and Union cheaper when generic code reads a single view, while
preserving their exact public types.
BottomLazy<
import SchemaASTSchemaAST.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,
interface $Array<S extends Constraint>Type-level representation returned by
Array
.
$Array<function (type parameter) S in $Array<S extends Constraint>S>
>
{
readonly "Type": interface ReadonlyArray<T>ReadonlyArray<function (type parameter) S in $Array<S extends Constraint>S["Type"]>
readonly "Encoded": interface ReadonlyArray<T>ReadonlyArray<function (type parameter) S in $Array<S extends Constraint>S["Encoded"]>
readonly "DecodingServices": function (type parameter) S in $Array<S extends Constraint>S["DecodingServices"]
readonly "EncodingServices": function (type parameter) S in $Array<S extends Constraint>S["EncodingServices"]
readonly "~type.make.in": interface ReadonlyArray<T>ReadonlyArray<function (type parameter) S in $Array<S extends Constraint>S["~type.make"]>
readonly "~type.make": interface ReadonlyArray<T>ReadonlyArray<function (type parameter) S in $Array<S extends Constraint>S["~type.make"]>
readonly "Iso": interface ReadonlyArray<T>ReadonlyArray<function (type parameter) S in $Array<S extends Constraint>S["Iso"]>
readonly $Array<S extends Constraint>.value: S extends Constraintvalue: function (type parameter) S in $Array<S extends Constraint>S
}