// Type definitions for async-lock 1.1 // Project: https://github.com/rain1017/async-lock, https://github.com/rogierschouten/async-lock // Definitions by: Elisée MAURER // Alejandro // Anatoly // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.1 type AsyncLockDoneCallback = (err?: Error, ret?: T) => void; interface AsyncLockOptions { timeout?: number; maxPending?: number; domainReentrant?: boolean; Promise?: any; } declare class AsyncLock { constructor(options?: AsyncLockOptions); acquire(key: string | string[], fn: (() => T | PromiseLike) | ((done: AsyncLockDoneCallback) => any), opts?: AsyncLockOptions): Promise; acquire(key: string | string[], fn: (done: AsyncLockDoneCallback) => any, cb: AsyncLockDoneCallback, opts?: AsyncLockOptions): void; isBusy(key?: string): boolean; } declare namespace AsyncLock { } export = AsyncLock;