import { type FixDeepFunctionInfer, type NeverCoalescing } from "../../common"; import { type DataParserDefinition } from "../base"; import { type DataParserError, type SymbolDataParserError } from "../../dataParser/error"; import { type DataParserChecker } from "../baseChecker"; import { type ApplyRefinementOfDefinition, type AddCheckersToDefinition, type GetEligibleChecker, type MergeDefinition, type Output, type PrepareDataParserDefinition } from "../types"; export type LiteralValue = string | number | bigint | undefined | null | boolean; export type DataParserLiteralCheckers = GetEligibleChecker; export interface DataParserDefinitionLiteral extends DataParserDefinition> { readonly value: readonly LiteralValue[]; } export declare const literalKind: import("../../common").KindHandler>; declare const DataParserLiteral_base: import("..").DataParserBaseInit>>; export declare class DataParserLiteral extends DataParserLiteral_base, ApplyRefinementOfDefinition> { get classConstructor(): typeof DataParserLiteral & import("..").CheckedConstructorKind; addChecker: >, ...DataParserChecker>[] ]>(...args: FixDeepFunctionInfer>, ...DataParserChecker>[] ], GenericChecker>) => DataParserLiteral>; static execParse(self: DataParserLiteral, data: unknown, error: DataParserError): LiteralValue | typeof SymbolDataParserError; static dataParserIsAsynchronous(self: DataParserLiteral): boolean; static prepareDefinition(value: LiteralValue | readonly LiteralValue[], definition?: Partial>): DataParserDefinitionLiteral; /** * Creates a data parser for a literal value. * * **Supported call styles:** * - Classic: `DP.literal(value)` -> returns a literal parser * - Curried: not available * * Accepts only the provided literal value and rejects any other input. * * ```ts * const parser = DP.literal("status"); * const result = parser.parse("status"); * if (E.isRight(result)) { * const value = unwrap(result); * // value: "status" * } * * const numberLiteral = DP.literal(42); * const numberResult = numberLiteral.parse(42); * * const boolLiteral = DP.literal(true); * const boolResult = boolLiteral.parse(true); * ``` * * @see https://utils.duplojs.dev/en/v1/api/dataParser/literal * * @namespace DP * */ static create, "value"> = never>(value: GenericValue | readonly GenericValue[], definition?: FixDeepFunctionInfer, "value">, GenericDefinition>): DataParserLiteral & { readonly value: readonly GenericValue[]; }>>; } /** * Creates a data parser for a literal value. * * **Supported call styles:** * - Classic: `DP.literal(value)` -> returns a literal parser * - Curried: not available * * Accepts only the provided literal value and rejects any other input. * * ```ts * const parser = DP.literal("status"); * const result = parser.parse("status"); * if (E.isRight(result)) { * const value = unwrap(result); * // value: "status" * } * * const numberLiteral = DP.literal(42); * const numberResult = numberLiteral.parse(42); * * const boolLiteral = DP.literal(true); * const boolResult = boolLiteral.parse(true); * ``` * * @see https://utils.duplojs.dev/en/v1/api/dataParser/literal * * @namespace DP * */ export declare const literal: typeof DataParserLiteral.create; export {};