Skip to content

Type Alias: PathBuildResult

API / @xmachines/play-url / index / PathBuildResult

type PathBuildResult =
| {
ok: true;
path: string;
}
| {
missing: string;
ok: false;
reason: "missing";
}
| {
ok: false;
param: string;
reason: "unresolvable";
value: string;
};

Defined in: packages/play-pattern/src/pattern-grammar.ts:651

The answer of buildPath.

Union Members

Type Literal

{
ok: true;
path: string;
}

The pattern built a path, and every part that needs a value has one.


Type Literal

{
missing: string;
ok: false;
reason: "missing";
}

A part needs a value that the caller did not give.

missing names the param as the PATTERN declares it, with each hyphen kept, so a caller reports the name that its author wrote.


Type Literal

{
ok: false;
param: string;
reason: "unresolvable";
value: string;
}

A param carries a value that no path can hold, so the pattern matches the result back never. param names the param, and value holds what the caller gave.

A dot segment is the one such value today: see isDotSegment.