type-alias / @typed/router/Parser

Parser.Many1Internal

Runs one required repetition before delegating to zero-or-more parsing.

Package version
1.0.0-beta.7
Category
Parser repetition
Since
1.0.0
Member of
Parser

Import

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

Access Parser.Many1Internal through the imported Parser export. Its declaration below describes the member.

Signatures

type Many1Internal<P extends Any, Input extends string> = Apply<P, Input> extends infer R ? [
    R
] extends [
    never
] ? never : R extends readonly [
    infer Value,
    infer Rest extends string
] ? IsNoProgress<Input, Rest> extends true ? never : ManyInternal<P, Rest, readonly [
    Value
]> : never : never;

Why

Many1 fails when the first parse fails or makes no progress.

Ownership and lifetime

Many1Internal performs its required first parse only in TypeScript’s type system, then delegates to ManyInternal; no runtime parser value exists.

Source