export type Result = { isSuccess: true; value: T; } | { isSuccess: false; error: E; }; /** * Runs a closure and wraps the return value in a Result. The `isSuccess` * value is `false` if the close throws, otherwise it's `true`. */ export declare function Result(block: () => T | Promise): Promise>; /** * The difference between this and `Promise.all` is that `Promise.all` rejects * when any promise rejects, and this resolves when all promises resolve _or_ * reject. * * This function returns an array of results, each of which is either a success * result containing the resolved promise, or an error result containing the * value that was passed to `reject()`. * * This function itself never throws or rejects. */ export declare const allToResolveOrReject: (promises: Promise[]) => Promise[]>; /** * Attach a dummy rejection handler to a promise and return the original * promise. Used to prevent unhandled rejections in the background. * * To use this, wrap any `async` or `Promise`-returning function with this * function and use it as you otherwise would. * * Calling this multiple times for the same promise should have no ill effect. * * @example * // Before * await fetch('https://hevy.com/blabla'); * * // After * await handleRejection(fetch('https://hevy.com/blabla')); */ export declare const handleRejection: (p: Promise) => Promise; type Stage3MethodDecorator = (value: (...args: any[]) => T, context: ClassMemberDecoratorContext) => (...args: any[]) => T; export declare function _synchronized_3(queue: boolean): Stage3MethodDecorator>; export declare function _synchronized_3(queue: boolean, id: any): Stage3MethodDecorator>; export declare function _synchronized_3(value: (...args: any[]) => any, context: ClassMemberDecoratorContext): void; type LegacyMethodDecorator = (target: unknown, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<(...args: any[]) => T>) => void; export declare function synchronized(queue: boolean): LegacyMethodDecorator>; export declare function synchronized(queue: boolean, id: any): LegacyMethodDecorator>; export declare function synchronized(target: unknown, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<(...args: any[]) => Promise>): void; export declare abstract class LockError extends Error { abstract readonly propertyKey: string | symbol; abstract readonly lockId: unknown; protected constructor(...args: any); } export {};