Skip to content

Documentation / @einvoice-ts/validator / ValidationResult

Type Alias: ValidationResult<D> ​

ValidationResult<D> = ValidationFailure | ValidationSuccess<D>

Defined in: packages/validator/src/engine/validate.ts:188

What validate returns; narrow on ok to reach the validated document.

Type Parameters ​

D ​

D extends Document = Document

Example ​

ts
import { validate } from '@einvoice-ts/validator';

const result = validate(parsed.document);
if (result.ok) {
  result.document.id; // typed as Invoice
} else {
  result.fatal.map((issue) => issue.id);
}

MIT licensed. Specification material belongs to OpenPeppol, CEN and OASIS (see NOTICE). Peppol is a trademark of OpenPeppol AISBL; this project is not affiliated with it.