/** * Base error class that preserves error name in stack traces * * All custom errors should extend this class to ensure: * - Proper stack trace with error name * - Cause chain support * - Consistent error handling */ export declare class BaseError extends Error { name: string; cause?: Error | undefined; constructor(name: string, message: string, cause?: Error | undefined); } /** * Factory that creates NAMED error classes (not anonymous) for proper stack traces * * The factory returns a named class that extends BaseError. * Stack traces will show the actual error class name, not "BaseError" or "createErrorClass". * * @example * ```typescript * export const FileSystemAccessError = createErrorClass( * 'FileSystemAccessError', * ([path, operation]: [string, string]) => `Failed to ${operation} ${path}` * ) * * // Stack trace will show: "at new FileSystemAccessError" * // NOT: "at new createErrorClass" or "at new BaseError" * ``` */ export declare function createErrorClass(name: string, template: (args: T) => string): new (...args: T) => BaseError;