variable / @typed/router

Number

Constructs a finite-number path parameter decoded from a string.

Package version
1.0.0-beta.13
Category
Parameter codecs
Since
1.0.0

Import

import { Number } from "@typed/router";

Signatures

export declare const Number: <const P extends string>(paramName: P) => Route<`/:${P}`, Schema.Codec<{
    readonly [K in P]: number;
}, Path.Params<`/:${P}`>>>;

Why

Numeric conversion failures stay in route decoding instead of reaching the handler as bad data.

Ownership and lifetime

Number constructs its Route immediately. The Route retains the supplied AST or route values and lazily memoizes derived paths and Codecs; Codec services are required only when decoding or encoding runs.

Other public imports

These import paths expose the same declaration. Each page retains its own public name and signature.

Source