export declare type BeforePatchFn = (ctx: PatchContext, ...args: A) => R | void; export declare type AfterPatchFn = (ctx: AfterPatchContext, result: R, ...args: A) => R | void; export declare type InsteadFn = (ctx: PatchContext, ...args: A) => R; export declare type Unpatch = () => void; export declare enum PatchPriority { MIN = 0, DEFAULT = 15, MAX = 30 } declare type PatchFns = { before?: BeforePatchFn; instead?: InsteadFn; after?: AfterPatchFn; }; export declare class Patch { readonly priority: number; readonly plugin?: string | undefined; before: BeforePatchFn; after: AfterPatchFn; constructor(data: PatchFns, priority?: number, plugin?: string | undefined); } declare class PatchContext { readonly thisObject: T; readonly args: A; private readonly backup; constructor(thisObject: T, args: A, backup: (...args: A) => R); private _result; private _error; /** Do not use */ _returnEarly: boolean; set result(value: R | undefined); get result(): R | undefined; get error(): Error | undefined; set error(error: Error | undefined); getResultOrThrowError(): R | undefined; callOriginal(): R; } declare type AfterPatchContext = PatchContext & { result: R; }; export declare function unpatch(obj: T | any, methodName: string, patch: Patch): void; export declare function callOriginal(func: (...args: any[]) => any, thisObj: any, ...args: any[]): any; export declare function patch(object: T | any, name: string, patch: Patch): Unpatch; export declare function before(object: any, name: string, before: BeforePatchFn, priority?: PatchPriority, plugin?: string): Unpatch; export declare function instead(object: any, name: string, instead: InsteadFn, priority?: PatchPriority, plugin?: string): Unpatch; export declare function insteadDoNothing(object: any, name: string): Unpatch; export declare function after(object: any, name: string, after: AfterPatchFn, priority?: PatchPriority, plugin?: string): Unpatch; export {};