interface FieldError { field: string; message: string; } type BackendErrorKind = 'notConfigured' | 'validation' | 'unauthorized' | 'rateLimited' | 'server' | 'network' | 'decode'; interface BackendErrorParams { code: string; message: string; status?: number; requestId?: string; fields?: FieldError[]; retryAfter?: number; data?: unknown; } declare class BackendError extends Error { readonly kind: BackendErrorKind; readonly code: string; readonly status: number; readonly requestId?: string; readonly fields?: FieldError[]; readonly retryAfter?: number; readonly data?: unknown; constructor(kind: BackendErrorKind, params: BackendErrorParams); static notConfigured(): BackendError; } /** * Type guard for BackendError that survives module-identity splits. * This package ships dual ESM + CJS builds; if both end up loaded (or the * package is installed twice), two distinct BackendError classes coexist and * `instanceof` fails for errors thrown by "the other" copy. Falls back to a * structural check on `name` + `kind`. */ declare function isBackendError(e: unknown): e is BackendError; export { BackendError as B, type FieldError as F, type BackendErrorKind as a, isBackendError as i };