FuncType - v1.4.1
    Preparing search index...

    Variable DecoderError

    DecoderError: { _tag: "DecoderError" } & {
        composite: (
            path: readonly string[],
            children: List<DecoderError>,
        ) => DecoderErrorComposite;
        flatten: (
            e: DecoderError,
        ) => List<{ message: string; path: readonly string[] }>;
        format: (e: DecoderError) => string;
        isComposite: (e: DecoderError) => e is DecoderErrorComposite;
        isLeaf: (e: DecoderError) => e is DecoderErrorLeaf;
        leaf: (
            path: readonly string[],
            message: string,
            cause?: unknown,
        ) => DecoderErrorLeaf;
        match: <T>(
            e: DecoderError,
            patterns: {
                Composite: (e: DecoderErrorComposite) => T;
                Leaf: (e: DecoderErrorLeaf) => T;
            },
        ) => T;
        prepend: (segment: string, e: DecoderError) => DecoderError;
    }

    Type Declaration

    • Readonly_tag: "DecoderError"
    • composite: (path: readonly string[], children: List<DecoderError>) => DecoderErrorComposite
    • flatten: (e: DecoderError) => List<{ message: string; path: readonly string[] }>

      Walk the error tree and collect every leaf failure as a flat list of {path, message} records. Useful when surfacing errors to a UI that wants one line per problem.

    • format: (e: DecoderError) => string

      Render the error tree as a human-readable multi-line string. Paths are dotted (user.address.city); indices are bracketed (tags[0]).

    • isComposite: (e: DecoderError) => e is DecoderErrorComposite
    • isLeaf: (e: DecoderError) => e is DecoderErrorLeaf
    • leaf: (path: readonly string[], message: string, cause?: unknown) => DecoderErrorLeaf
    • match: <T>(
          e: DecoderError,
          patterns: {
              Composite: (e: DecoderErrorComposite) => T;
              Leaf: (e: DecoderErrorLeaf) => T;
          },
      ) => T
    • prepend: (segment: string, e: DecoderError) => DecoderError

      Prepend a path segment to an error. Used by Decoder.object and Decoder.list to attribute a child decoder's failures to the field / index they were decoded under. Recurses into Composite children so every Leaf in the tree carries its full absolute path.