interface / @typed/router/AST

MatchAst.Route

A Match AST candidate containing one Route AST, Guard, and output handler.

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

Import

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

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

Signatures

interface Route {
    type: "route";
    route: RouteAst;
    guard: Guard<any, any, any, any>;
    handler: MatchHandler<any, any, any, any>;
}

Why

Decoding, guard selection, and output stay attached in declaration order.

Ownership and lifetime

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

Property: guard

The guard evaluated after parameter decoding and dependency preparation.

Property: guard: Why

A Some selects the candidate; None or failure can fall through without mounting its handler.

Property: guard: Ownership and lifetime

The guard function is retained with the candidate. Its Effect and service requirements begin only when the executor evaluates that candidate.

Property: handler

The output producer mounted for a selected route.

Property: handler: Why

Values, Effect, Stream, and Fx all normalize to the same push-based Fx contract.

Property: handler: Ownership and lifetime

The producer is retained with the candidate; the selected route Scope owns the Fx it returns and interrupts that Fx on replacement.

Property: route

Constructs a route-case Match AST node with its guard and handler.

Property: route: Why

Candidate order, decoding, guard selection, and output remain one inspectable registration unit.

Property: route: Ownership and lifetime

The Match AST retains the immutable Route AST by reference until the Matcher becomes unreachable.

Property: type

The discriminant identifying this AST variant.

Property: type: Why

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

Source