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 ​
readonlydiagnostics: readonlyIssue[]
Defined in: parse.ts:49
Every structural problem found, in document order.
document ​
readonlydocument:T
Defined in: parse.ts:51
The model, mapped as far as the document allowed.
ok ​
readonlyok:boolean
Defined in: parse.ts:53
Whether no diagnostic is fatal.