Skip to content

Documentation / @facturometro/parser / ParseResult

Interface: ParseResult<T> ​

Defined in: parse.ts:47

What a parse produced: the model, everything wrong with the document's structure, and whether any of it is fatal.

document is always present. A document with fatal diagnostics is still mapped as far as it could be, which is what makes a parse plus a validation report every problem at once instead of stopping at the first.

Example ​

ts
import { parseInvoice } from '@facturometro/parser';

const result: ParseResult<UncheckedInvoice> = parseInvoice(xml);
if (!result.ok) console.error(result.diagnostics.map((issue) => issue.id));

Type Parameters ​

T ​

T

Properties ​

diagnostics ​

readonly diagnostics: readonly Issue[]

Defined in: parse.ts:49

Every structural problem found, in document order.


document ​

readonly document: T

Defined in: parse.ts:51

The model, mapped as far as the document allowed.


ok ​

readonly ok: boolean

Defined in: parse.ts:53

Whether no diagnostic is fatal.

MIT licensed. Specification artefacts belong to OpenPEPPOL, CEN and OASIS.