import { IParser, OnParse } from "./interfaces"; import { Parser } from "./parser"; /** * This parser is used when trying to create parsers that * user their own definitions in their types, like interface Tree { * [key: string]: Tree | Leaf; * } */ export declare class RecursiveParser implements IParser { readonly recursive: (parser: Parser) => Parser; readonly description: { readonly name: "Recursive"; readonly children: readonly []; readonly extras: readonly [(parser: Parser) => Parser]; }; private parser?; static create(fn: (parser: Parser) => Parser): RecursiveParser; private constructor(); parse(a: unknown, onParse: OnParse): C | D; } type EnsurredType = (A extends never ? never : unknown) & ((parser: Parser) => Parser); /** * Must pass the shape that we expect since typescript as of this point * can't infer with recursive functions like this. * @param fn This should be a function that takes a parser, basically the self in a type recursion, and * return a parser that is the combination of the recursion. * @returns */ export declare function recursive(fn: EnsurredType): Parser; export {};