Skip to content

describeValue

describeValue(value): string

Defined in: packages/core/src/merkle-dag-serialization.ts:81

Human-readable label for an unknown value’s runtime type, used in wire validation error messages.

typeof alone reports 'object' for both null and arrays, which obscures common malformed-peer cases. This helper distinguishes those:

  • null -> 'null'
  • any array -> 'array'
  • anything else -> raw typeof result ('object', 'string', 'number', 'boolean', 'undefined', etc.)

Use in validation error strings whenever a field’s expected type is not already enforced to be a primitive, so error attribution back to the peer is unambiguous.

unknown

string