Skip to main content
Version: v0.0.4

Type Alias: UcumValidation

UcumValidation = { canonical: string; valid: true; } | { code: "TERM_UCUM_INVALID"; reason: string; valid: false; }

The result of validateUcum: a valid unit with its canonical descriptor, or a typed invalid carrying the stable TERM_UCUM_INVALID diagnostic and a value-free reason.

Union Members

Type Literal

{ canonical: string; valid: true; }

canonical

readonly canonical: string

A stable, normalized descriptor of the unit's canonical form - equal iff the units are the same (see ucumEqual). Note: this is a comparison/debug descriptor, not guaranteed to be a re-parseable UCUM expression (UCUM cannot express arbitrary numeric factors as literals).

valid

readonly valid: true

The expression is a well-formed UCUM unit over known atoms.


Type Literal

{ code: "TERM_UCUM_INVALID"; reason: string; valid: false; }

code

readonly code: "TERM_UCUM_INVALID"

The stable diagnostic code - never a guessed "nearest" unit (the never-fabricate rule).

reason

readonly reason: string

A value-free structural reason (a grammar fault or an unknown atom; never PHI).

valid

readonly valid: false

The expression is not a valid UCUM unit.