Defjs
Core

ErrorMap

Optional callback that rewrites a StructIssue message before it is stored.

@defjs/core · Type

Signature

type ErrorMap = (issue: StructIssue) => string | undefined;

Passed as the errorMap option of struct.parse. It is called for each issue (code, expected, message, path, received) before the issue is recorded. Any string, including '', replaces the default message; only undefined keeps it. The map belongs to this parse call and also handles bigint/date conversion failures from a struct created by another Core copy. Default messages omit received values; custom text is used verbatim, so avoid including sensitive received values.

Parameters

Prop

Type

issue StructIssue

Issue about to be recorded.

Returns

Replacement message, or undefined to keep the default.

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