Skip to main content
Version: v0.0.2

Type Alias: X12WarningCode

X12WarningCode = typeof WARNING_CODES[keyof typeof WARNING_CODES]

Discriminant type for X12ParseWarning.code. Narrowing a warning by this code lets consumers write exhaustive switch blocks and guarantees a typo-free comparison against the WARNING_CODES registry.

Example

import type { X12ParseWarning, X12WarningCode } from "@cosyte/x12";
function describe(w: X12ParseWarning): string {
const code: X12WarningCode = w.code;
switch (code) {
case "X12_PRE_005010":
return "pre-005010 sender";
default:
return `warning: ${code}`;
}
}