import { type FixDeepFunctionInfer, type IsEqual, type NeverCoalescing } from "../../common"; import { type DataParser, type DataParserDefinition } from "../base"; import { type DataParserError } from "../../dataParser/error"; import { type DataParserChecker } from "../baseChecker"; import { type ApplyRefinementOfDefinition, type AddCheckersToDefinition, type GetEligibleChecker, type Input, type MergeDefinition, type Output, type PrepareDataParserDefinition } from "../types"; export type DataParserNullableCheckers = GetEligibleChecker; export interface DataParserDefinitionNullable extends DataParserDefinition> { readonly inner: DataParser; readonly coalescingValue: GenericOutput; } export declare const nullableKind: import("../../common").KindHandler>; declare const DataParserNullable_base: import("..").DataParserBaseInit>>; export declare class DataParserNullable extends DataParserNullable_base extends true ? Output | null : Output, GenericDefinition>, ApplyRefinementOfDefinition | null, GenericDefinition>> { get classConstructor(): typeof DataParserNullable & import("..").CheckedConstructorKind; addChecker: >, ...DataParserChecker>[] ]>(...args: FixDeepFunctionInfer>, ...DataParserChecker>[] ], GenericChecker>) => DataParserNullable>; static execParse(self: DataParserNullable, data: unknown, error: DataParserError): unknown; static dataParserIsAsynchronous(self: DataParserNullable): boolean; static prepareDefinition(inner: DataParser, definition?: Partial>): DataParserDefinitionNullable; /** * Creates a data parser that accepts null or the inner parser output. * * **Supported call styles:** * - Classic: `DP.nullable(inner, definition?)` -> returns a nullable parser * - Curried: not available * * Returns null (or a coalescing value) when input is null, otherwise parses with the inner parser. * * ```ts * const parser = DP.nullable(DP.string()); * const result = parser.parse(null); * if (E.isRight(result)) { * const value = unwrap(result); * // value: string | null * } * * const withCoalescing = DP.nullable(DP.number(), { coalescingValue: 0 }); * const coalesced = withCoalescing.parse(null); * * const withCheckers = DP.nullable(DP.boolean(), { * checkers: [DP.checkerRefine((value) => value !== null)], * }); * ``` * * @see https://utils.duplojs.dev/en/v1/api/dataParser/nullable * * @namespace DP * */ static create>, "inner"> = never>(inner: GenericDataParser, definition?: FixDeepFunctionInfer>, "inner">, GenericDefinition>): DataParserNullable & { inner: GenericDataParser; }>>; } /** * Creates a data parser that accepts null or the inner parser output. * * **Supported call styles:** * - Classic: `DP.nullable(inner, definition?)` -> returns a nullable parser * - Curried: not available * * Returns null (or a coalescing value) when input is null, otherwise parses with the inner parser. * * ```ts * const parser = DP.nullable(DP.string()); * const result = parser.parse(null); * if (E.isRight(result)) { * const value = unwrap(result); * // value: string | null * } * * const withCoalescing = DP.nullable(DP.number(), { coalescingValue: 0 }); * const coalesced = withCoalescing.parse(null); * * const withCheckers = DP.nullable(DP.boolean(), { * checkers: [DP.checkerRefine((value) => value !== null)], * }); * ``` * * @see https://utils.duplojs.dev/en/v1/api/dataParser/nullable * * @namespace DP * */ export declare const nullable: typeof DataParserNullable.create; export {};