interface / @typed/router/AST

MatchAst.Layer

A Match AST boundary carrying route-local Effect Layers.

Package version
1.0.0-beta.13
Category
Matcher composition syntax
Since
1.0.0
Member of
MatchAst

Import

import { MatchAst } from "@typed/router/AST";

Access MatchAst.Layer through the imported MatchAst export. Its declaration below describes the member.

Signatures

interface Layer {
    type: "layer";
    matches: ReadonlyArray<MatchAst>;
    deps: ReadonlyArray<AnyLayer>;
}

Why

Dependencies can be prepared, committed, rolled back, and finalized with candidate selection.

Ownership and lifetime

Layer describes plain readonly AST data. Routes and Matchers retain the concrete nodes they receive by reference; the type itself owns no resource.

Property: deps

The Effect Layers attached to a matcher subtree.

Property: deps: Why

Candidate services and their failures stay explicit during preparation and rollback.

Property: deps: Ownership and lifetime

Layer values are retained by identity. The executor’s Layer manager, not the AST, owns their acquired child Scopes and rollback.

Property: matches

The ordered child matcher nodes wrapped by this boundary.

Property: matches: Why

Order is preserved for candidate and guard fallthrough.

Property: matches: Ownership and lifetime

The Layer boundary retains this ordered child array by reference so compilation preserves same-path candidate fallthrough.

Property: type

The discriminant identifying this AST variant.

Property: type: Why

Exhaustive switches can interpret syntax without instanceof checks or hidden classes.

Source