Skip to content

DiagNode

DiagNode = DiagNodeBase & { kind: "int"; value: bigint; } | { kind: "float"; value: number; } | { kind: "bytes"; value: Uint8Array; } | { kind: "text"; value: string; } | { items: readonly DiagNode[]; kind: "array"; } | { entries: readonly readonly [DiagNode, DiagNode][]; kind: "map"; } | { kind: "tag"; tag: bigint; value: DiagNode; } | { kind: "bool"; value: boolean; } | { kind: "null"; } | { kind: "undefined"; } | { kind: "simple"; value: number; }

Defined in: packages/format-cbor/src/notation/diag-node.ts:24

The parsed tree for CBOR diagnostic notation.

There is no separate CST here: unlike @ac-kit/format-asn1-notation (where many syntactically different forms — tag class keywords, parenthesization, IMPLICIT/EXPLICIT — collapse to the same semantic AST), diagnostic notation has essentially no such redundancy: it is already a near-literal rendering of the DataValue tree it represents. Attaching span and leadingComments directly to the value tree is therefore lossless on its own; a redundant middle tree would carry no information the value tree doesn’t already have.