@types/promise-inflight
Version:
TypeScript definitions for promise-inflight
42 lines (34 loc) • 1.41 kB
Markdown
# Installation
> `npm install --save @types/promise-inflight`
# Summary
This package contains type definitions for promise-inflight (https://github.com/iarna/promise-inflight#readme).
# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/promise-inflight.
## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/promise-inflight/index.d.ts)
````ts
export = inflight;
type Resolvable<T> = PromiseLike<T> | T;
/**
* @param unique A globally-unique key that is used to identify the call to this
* function. It determines how to cache the inlfight request. eg. a url or
* filename or whatever.
* @param doFly The function that actually carries out the request, eg. fetches
* the url or whatever.
* @returns One promise as long as the `doFly()` promise is pending. Note that
* if `bluebird` is installed, this promise will be a Bluebird promise.
*/
declare function inflight<T>(
unique: Resolvable<string> | Resolvable<ReadonlyArray<Resolvable<string>>>,
doFly: () => Resolvable<T>,
): Promise<T>;
declare namespace inflight {
const active: {
[key: string]: Promise<any>;
};
}
````
### Additional Details
* Last updated: Tue, 07 Nov 2023 09:09:39 GMT
* Dependencies: none
# Credits
These definitions were written by [Emily Marigold Klassen](https://github.com/forivall).