interface / @typed/router/AST

MatchAst.Prefixed

A Match AST node that structurally prefixes nested cases.

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.Prefixed through the imported MatchAst export. Its declaration below describes the member.

Signatures

interface Prefixed {
    type: "prefixed";
    matches: ReadonlyArray<MatchAst>;
    prefix: RouteAst;
}

Why

Nested route tables can be mounted without rewriting each child route.

Ownership and lifetime

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

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 prefix boundary retains this ordered child array by reference and applies the prefix only during structural compilation.

Property: prefix

The Route AST prepended to nested matcher cases.

Property: prefix: Why

Prefixing remains structural and participates in schema/path compilation.

Property: prefix: Ownership and lifetime

The prefix Route AST is retained by reference and owns no decoded parameter state.

Property: type

The discriminant identifying this AST variant.

Property: type: Why

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

Source