mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
* Add types for promise-memoize * fixup! Add types for promise-memoize * Add clear to promise-memoize tests
23 lines
721 B
TypeScript
23 lines
721 B
TypeScript
// Type definitions for promise-memoize 1.2
|
|
// Project: https://github.com/nodeca/promise-memoize#readme
|
|
// Definitions by: Emily Marigold Klassen <https://github.com/forivall>
|
|
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
|
// TypeScript Version: 2.1
|
|
|
|
export = promiseMemoize;
|
|
|
|
declare function promiseMemoize<T extends (...args: any[]) => PromiseLike<any>>(
|
|
fn: T, options?: promiseMemoize.Options
|
|
): T & {
|
|
clear(): void;
|
|
};
|
|
|
|
declare namespace promiseMemoize {
|
|
interface Options {
|
|
maxAge?: number;
|
|
maxErrorAge?: number;
|
|
resolve?: KeyResolver;
|
|
}
|
|
type KeyResolver = 'simple' | 'json' | ((args: any[]) => any) | ReadonlyArray<'json' | ((arg: any) => any)>;
|
|
}
|