export type ConvertErrorCode = | 'malformed-directive' | 'malformed-pipe-table' | 'not-an-adf-document' | 'unknown-directive-name' | 'unmappable-html' | 'unmappable-image' | 'unspellable-adjacent-lists' | 'unspellable-character' | 'unspellable-line-start' | 'unspellable-link-destination' | 'unspellable-link-title' | 'unspellable-whitespace' | 'unspelled-block-separation' | 'unsupported-document-version' | 'unsupported-nesting-depth' | 'unsupported-node-shape' export type ConvertErrorPath = readonly (number | string)[] export type ConvertFault = { code: ConvertErrorCode message: string } export type ConvertError = ConvertFault & { path: ConvertErrorPath } export type Result = { error: ConvertError; ok: false } | { ok: true; value: T } export function failure(code: ConvertErrorCode, message: string, path: ConvertErrorPath): Result { return { error: { code, message, path }, ok: false } } export function success(value: T): Result { return { ok: true, value } }