type-alias / @typed/router/AST

MatchAst

The union of route, dependency, layout, prefix, and catch matcher nodes.

Package version
1.0.0-beta.13
Category
Route structure
Since
1.0.0

Import

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

Signatures

export type MatchAst = MatchAst.Route | MatchAst.Layer | MatchAst.Layout | MatchAst.Prefixed | MatchAst.Catch;
export declare namespace MatchAst {
    interface Route {
        type: "route";
        route: RouteAst;
        guard: Guard<any, any, any, any>;
        handler: MatchHandler<any, any, any, any>;
    }
    interface Layer {
        type: "layer";
        matches: ReadonlyArray<MatchAst>;
        deps: ReadonlyArray<AnyLayer>;
    }
    interface Layout {
        type: "layout";
        matches: ReadonlyArray<MatchAst>;
        layout: LayoutType<any, any, any, any, any, any, any>;
    }
    interface Prefixed {
        type: "prefixed";
        matches: ReadonlyArray<MatchAst>;
        prefix: RouteAst;
    }
    interface Catch {
        type: "catch";
        matches: ReadonlyArray<MatchAst>;
        f: (cause: RefSubject<Cause<any>>) => Fx<any, any, any>;
    }
}

Why

Matcher composition remains inspectable before runtime compilation.

Ownership and lifetime

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

Members

  • MatchAst.Catch

    A Match AST node defining a reactive cause boundary.

  • MatchAst.Layer

    A Match AST boundary carrying route-local Effect Layers.

  • MatchAst.Layout

    A function that wraps matched content using reactive params.

  • MatchAst.Prefixed

    A Match AST node that structurally prefixes nested cases.

  • MatchAst.Route

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

Source