import * as RNEA from 'fp-ts/ReadonlyNonEmptyArray'; import type * as Sg from 'fp-ts/Semigroup'; /** * Represents an error ADT that occurs while encoding or decoding * * @since 2.0.0 * @category Model */ export type TranscodeError = TypeMismatch | UnexpectedValue | SerializationError | ErrorAtIndex | ErrorAtKey | ErrorAtUnionMember; /** * A readonly non-empty array of transcode errors * * @since 2.0.0 * @category Model */ export declare class TranscodeErrors { readonly errors: RNEA.ReadonlyNonEmptyArray; /** @since 2.0.0 */ readonly _tag = "TranscodeErrors"; constructor(errors: RNEA.ReadonlyNonEmptyArray); /** @since 2.2.0 */ toJSON(this: TranscodeErrors): string; /** @since 2.2.0 */ toString(this: TranscodeErrors): string; } /** * Represents a mismatched value * * @since 2.0.0 * @category Model */ export declare class TypeMismatch { readonly expected: string; readonly actual: unknown; /** @since 2.0.0 */ readonly _tag = "TypeMismatch"; constructor(expected: string, actual: unknown); } /** * Represents an error serializing or deserializing a value * * @since 2.0.0 * @category Model */ export declare class SerializationError { readonly expected: string; readonly error: unknown; readonly actual: unknown; /** @since 2.0.0 */ readonly _tag = "SerializationError"; constructor(expected: string, error: unknown, actual: unknown); } /** * Represents an error for when a value is present but was not expected * * @since 2.0.0 * @category Model */ export declare class UnexpectedValue { readonly actual: unknown; /** @since 2.0.0 */ readonly _tag = "UnexpectedValue"; constructor(actual: unknown); } /** * Represents an error at a specific index * * @since 2.0.0 * @category Model */ export declare class ErrorAtIndex { readonly index: number; readonly errors: TranscodeErrors; /** @since 2.0.0 */ readonly _tag = "ErrorAtIndex"; constructor(index: number, errors: TranscodeErrors); } /** * Represents an error at a specific key * * @since 2.0.0 * @category Model */ export declare class ErrorAtKey { readonly key: string; readonly errors: TranscodeErrors; /** @since 2.0.0 */ readonly _tag = "ErrorAtKey"; constructor(key: string, errors: TranscodeErrors); } /** * Represents an error that occurred for a particular union member * * @since 2.0.0 * @category Model */ export declare class ErrorAtUnionMember { readonly member: number | string; readonly errors: TranscodeErrors; /** @since 2.0.0 */ readonly _tag = "ErrorAtUnionMember"; constructor(member: number | string, errors: TranscodeErrors); } /** * @since 2.0.0 * @category Instances */ export declare const Semigroup: Sg.Semigroup; /** * Flattens a `DecodeError` tree into a common Semigroup * * @since 2.0.0 * @category Destructors */ export declare const fold: (S: Sg.Semigroup) => (matchers: { readonly TypeMismatch: (e: TypeMismatch, depth: number) => S; readonly UnexpectedValue: (e: UnexpectedValue, depth: number) => S; readonly SerializationError: (e: SerializationError, depth: number) => S; readonly ErrorAtIndex: (err: ErrorAtIndex, depth: number, recurseDepthFirst: (errs: TranscodeErrors) => S) => S; readonly ErrorAtKey: (err: ErrorAtKey, depth: number, recurseDepthFirst: (errs: TranscodeErrors) => S) => S; readonly ErrorAtUnionMember: (err: ErrorAtUnionMember, depth: number, recurseDepthFirst: (errs: TranscodeErrors) => S) => S; }) => (e: TranscodeErrors) => S; /** * Flattens a `DecodeError` tree into a common Semigroup with access to the current * accumulation and current level of depth * * @since 2.0.0 * @category Destructors */ export declare const foldMapDepthFirst: (S: Sg.Semigroup) => (matchers: { readonly TypeMismatch: (expected: string, actual: unknown, depth: number) => S; readonly UnexpectedValue: (actual: unknown, depth: number) => S; readonly SerializationError: (expected: string, error: unknown, actual: unknown, depth: number) => S; readonly ErrorAtIndex: (index: number, errors: S, depth: number) => S; readonly ErrorAtKey: (key: string, errors: S, depth: number) => S; readonly ErrorAtUnionMember: (member: number | string, errors: S, depth: number) => S; }) => (e: TranscodeErrors) => S; /** * Draws a tree of `TranscodeErrors` as lines with configurable prefix characters. * * The first argument, `prefix` appends any string or character to a concrete node. The * depth represents how many generations are between the root node and the current node. * The total children represents the total number of children the current node has. If a * node has zero children, it is a concrete node; i.e. type-mismatch, unexpected value, or * serialization error. If a node has one or more children, it is a container node; i.e. * error-at-key, error-at-index, or error-at-union-member. * * The second argument, `prefixChildren` appends any string or character to a child node, * which would have already been prefixed by the first argument. It will be called for * nodes that have been prefixed many times. * * The third argument, `errorStrings` is a configuration object that can be used to * override the default error type templates * * @since 2.0.0 * @category Destructors */ export declare const prefixedLines: (prefix: (depth: number, totalChildren: number) => string, prefixChildren?: (depth: number, childIndex: number, totalSiblings: number, innerNode: string) => string, errorStrings?: { readonly TypeMismatch?: ((expected: string, actual: unknown) => string) | undefined; readonly UnexpectedValue?: ((actual: unknown) => string) | undefined; readonly SerializationError?: ((expected: string, error: unknown, actual: unknown) => string) | undefined; readonly ErrorAtIndex?: ((index: number) => string) | undefined; readonly ErrorAtKey?: ((key: string) => string) | undefined; readonly ErrorAtUnionMember?: ((member: number | string) => string) | undefined; }) => (err: TranscodeErrors) => RNEA.ReadonlyNonEmptyArray; /** * Returns the total number of transcode errors * * @since 2.0.0 * @category Destructors */ export declare const totalErrors: (e: TranscodeErrors) => number; /** * Draws a tree of `TranscodeErrors` * * @since 2.0.0 * @category Destructors */ export declare const drawTree: (errors: TranscodeErrors, configuration?: { readonly showHeading?: boolean; }) => string; /** * Alias for `drawTree` * * @since 2.0.0 * @category Destructors */ export declare const draw: (errors: TranscodeErrors) => string; //# sourceMappingURL=TranscodeError.d.ts.map