import type { EventEmitter } from "events";
import type { ServerError } from "@superblocksteam/library-shared/types";
export type ErrorEventMap = {
    error: [error: ServerError];
};
/**
 * Interface for objects that can emit error events
 * Based on Node.js EventEmitter
 */
export interface ErrorEmitter {
    emit: EventEmitter<ErrorEventMap>["emit"];
    listeners: EventEmitter<ErrorEventMap>["listeners"];
}
/**
 * Wraps a method with error handling that emits an error event when an exception occurs
 * NOTE: This swallows the error
 *
 * @param instance - The object instance containing the method to wrap
 * @param methodName - The name of the method to wrap
 */
export declare function withErrorHandling<T extends ErrorEmitter>(instance: T, methodName: keyof T & string, details: {
    operation: string;
    rethrow?: boolean;
}): void;
/**
 * Helper function to apply error handling to multiple methods at once
 *
 * @param instance - The object instance containing the methods to wrap
 * @param methods - Record of method names to wrap with error handling
 */
export declare function applyErrorHandling<T extends ErrorEmitter>(instance: T, methods: Partial<Record<keyof T & string, {
    operation: string;
    rethrow?: boolean;
}>>): void;
//# sourceMappingURL=error-handler.d.ts.map