Type alias InferManyReturnType<T>

InferManyReturnType<T>: T extends CaptureParser<infer R, infer C>
    ? CaptureParser<R[], {
        captures: C[];
    }>
    : T extends Parser<infer R>
        ? Parser<R[]>
        : never

This is used to generate a return type for the many and many1 combinators. Given a parser we want to apply many to. Suppose its type is Parser<string>. This will return Parser<string[]> as the return type.

Suppose the parser is a CaptureParser<string, { name: string }>. This will return CaptureParser<string[], { captures: { name: string }[] }> as the return type.

Type Parameters

Generated using TypeDoc