/** * A proxy to handle awaiting a core promise before executing methods. * Supports inheritance and composition. * * For inheritance, extend AwaitProxy and use `withAwaited` to wrap methods. * * For composition, create an instance of AwaitProxy and use `apply` to * wrap methods of the target instance. */ export declare class AwaitProxy { private readonly _promise; private readonly _bindTo; private _awaited; constructor(_promise: Promise, _bindTo?: any); get awaited(): T; /** * Wraps all methods of the target instance to await the core promise before executing. * Or pass a list of method names to apply to. */ apply: (target: TTarget, onlyNames?: (keyof TTarget)[]) => void; /** * Extends a method to await the core promise and passes it as the * first argument. */ withAwaited(fn: (awaited: T, ...args: TArgs) => TReturn): (...args: TArgs) => Promise>; /** * Wraps a method to await the core promise but does not change * its arguments. */ afterAwaited(fn: (...args: TArgs) => TReturn): (...args: TArgs) => Promise>; } type Unpacked = T extends Promise ? U : T; export {};