Defjs
Core

StructIssue

A single validation failure produced while parsing a struct.

@defjs/core · Type

Signature

interface StructIssue {
  code:
    | "custom"
    | "invalid_enum"
    | "invalid_intersection"
    | "invalid_literal"
    | "invalid_type"
    | "invalid_union"
    | "missing_key";
  expected: string;
  message: string;
  path: Path;
  received: unknown;
}
  • code is the machine-readable category. The parser produces invalid_type, invalid_literal, invalid_enum, invalid_union, invalid_intersection, and missing_key; custom is part of the type, but the built-in structs never produce it.

  • expected describes the expected type or value.

  • message is the final text, after an optional ErrorMap rewrite.

  • path runs from the parse root to the failing location: field names and array indices. It is empty for a root-level failure.

  • received is the value that failed at path.

Members

Prop

Type

code "custom" | "invalid_enum" | "invalid_intersection" | "invalid_literal" | "invalid_type" | "invalid_union" | "missing_key"

Machine-readable failure category.

expected string

Human-readable description of the expected type or value.

message string

Final message after optional ErrorMap rewriting. The default names the received kind, not the value.

path Path

Path from the parse root to the failing location.

received unknown

Value that failed validation at path.

Edit this page on GitHub
Released under the MIT License. · Copyright © 2026 MunMunMiao