export interface SafePromise<T> {
    (): Promise<T>;
    checkPending(): boolean;
}
/**
 * Saving a long-lived reference to a promise that can reject can be unsafe,
 * since rejecting the promise causes an unhandled rejection error (even if the
 * rejection is handled everywhere promise result is expected).
 *
 * To avoid that, we add both resolution and rejection handlers to the promise.
 * That way, the saved promise never rejects. A callback is provided as return
 * value to build a *new* promise, that resolves and rejects along with
 * the original promise.
 * @param promise Promise to wrap, which possibly rejects
 * @returns Callback to build a new promise, which resolves and rejects along
 * with the original promise
 */
export declare function makeSafePromise<T>(promise: Promise<T>): SafePromise<T>;
export type PromiseWithResolvers<T> = {
    promise: Promise<T>;
    resolve: (value: T | PromiseLike<T>) => void;
    reject: (reason: any) => void;
    isResolved: () => boolean;
    isRejected: () => boolean;
};
/**
 * Creates a new promise with resolvers.
 *
 * Based on:
 * - https://github.com/tc39/proposal-promise-with-resolvers/blob/main/polyfills.js
 */
export declare const promiseWithResolvers: <T = void>() => PromiseWithResolvers<T>;
