import type { Dictionary } from '@grund/tools'; import type { CustomError } from './error'; export declare type ErrorType = typeof Error | typeof CustomError; export declare type ErrorInstance = Error | CustomError; export declare type ErrorMeta = Dictionary; export declare type ErrorArgs = Array; export interface GroupedErrorArgs { messages: string[]; metas: ErrorMeta[]; childErrors: ErrorInstance[]; } export interface ErrorObject { name: string; stack?: string; messages: string[]; metas: ErrorMeta[]; childErrors: ErrorObject[]; } declare global { /** * The reason that Error has to have partial properties (e.g. messages and metas) is that * the type validation in the node environment throws errors since it uses Error internally. * * And if we we are to extend the Error object with required properties, it is something that the node * packages doesn't take into account (obviously), hence throws some errors. */ interface Error extends Partial { message: string; meta?: ErrorMeta; is?: (err: ErrorType) => boolean; has?: (err: ErrorType) => boolean; toText?: () => string; toObject?: (includeStack?: boolean) => ErrorObject; getChildErrorObjects?: () => ErrorObject[]; } } //# sourceMappingURL=types.d.ts.map