# @types/promise-retry

> TypeScript definitions for promise-retry

Latest version **1.1.6** (published 2023-11-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install @types/promise-retry
pnpm add @types/promise-retry
yarn add @types/promise-retry
bun add @types/promise-retry
```

## Health

**Score 45/100 (D)** — status: abandoned.

Positive: has types; no vulnerabilities; high maintenance score; popular repo; extremely popular.

Warnings: low downloads; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 1.1.6 |
| Published | 2023-11-07 |
| First published | 2017-11-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 5.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 51427 |
| Maintainers | types |

## Links

- npm: https://www.npmjs.com/package/@types/promise-retry
- Repository: https://github.com/DefinitelyTyped/DefinitelyTyped
- Homepage: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/promise-retry
- npm.io page: https://npm.io/package/@types/promise-retry

## Dependencies (1)

- [@types/retry](https://npm.io/package/@types/retry.md) *

## Recent versions

- 1.1.6 (latest) — 2023-11-07
- 1.1.3 (ts2.3) — 2019-01-03
- 1.1.0 (ts2.0) — 2017-11-07
- 1.1.5 — 2023-10-18
- 1.1.4 — 2023-09-24
- 1.1.2 — 2018-05-31
- 1.1.1 — 2017-11-09

## README

# Installation
> `npm install --save @types/promise-retry`

# Summary
This package contains type definitions for promise-retry (https://github.com/IndigoUnited/node-promise-retry).

# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/promise-retry.
## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/promise-retry/index.d.ts)
````ts
import { OperationOptions } from "retry";
/**
 * A function that is retryable, by having implicitly-bound params for both an error handler and an attempt number.
 *
 * @param retry The retry callback upon any rejection. Essentially throws the error on in the form of a { retried: err }
 * wrapper, and tags it with a 'code' field of value "EPROMISERETRY" so that it is recognised as needing retrying. Call
 * this from the catch() block when you want to retry a rejected attempt.
 * @param attempt The number of the attempt.
 * @returns A Promise for anything (eg. a HTTP response).
 */
type RetryableFn<ResolutionType> = (retry: (error: any) => never, attempt: number) => Promise<ResolutionType>;
/**
 * Wrap all functions of the object with retry. The params can be entered in either order, just like in the original library.
 *
 * @param retryableFn The function to retry.
 * @param options The options for how long/often to retry the function for.
 * @returns The Promise resolved by the input retryableFn, or rejected (if not retried) from its catch block.
 */
declare function promiseRetry<ResolutionType>(
    retryableFn: RetryableFn<ResolutionType>,
    options?: OperationOptions,
): Promise<ResolutionType>;
declare function promiseRetry<ResolutionType>(
    options: OperationOptions,
    retryableFn: RetryableFn<ResolutionType>,
): Promise<ResolutionType>;
export = promiseRetry;

````

### Additional Details
 * Last updated: Tue, 07 Nov 2023 09:09:39 GMT
 * Dependencies: [@types/retry](https://npmjs.com/package/@types/retry)

# Credits
These definitions were written by [Jamie Birch](https://github.com/shirakaba).

---
_Source: https://npm.io/package/@types/promise-retry · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
