type-alias / @typed/router/AST

PathAst.Literal

An exact literal path or query-value AST node.

Package version
1.0.0-beta.7
Category
Path syntax
Since
1.0.0
Member of
PathAst

Import

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

Access PathAst.Literal through the imported PathAst export. Its declaration below describes the member.

Signatures

type Literal = {
    type: "literal";
    value: string;
};

Why

Literal nodes constrain matching without adding decoded parameters.

Ownership and lifetime

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

Property: type

Discriminates an exact literal node.

Property: type: Why

Formatters and match compilers can branch without hidden classes.

Property: type: Ownership and lifetime

The string literal is stored directly on the plain AST object for that object’s lifetime.

Property: value

Exact source text required by this node.

Property: value: Why

Literal matching and formatting must preserve the same spelling.

Property: value: Ownership and lifetime

The node retains the immutable string value and acquires no matcher resource.

Source