我有以下代码:
import {AsyncLock} from 'async-lock';
[ts]模块“my\u app/node\u modules/@types/async lock/index”没有导出的成员“AsyncLock”。
但是如果我看
my_app/node_modules/@types/async-lock/index.d.ts
interface AsyncLockDoneCallback {
(err?: Error, ret?: any): void;
}
interface AsyncLockOptions {
timeout?: number;
maxPending?: number;
domainReentrant?: boolean;
Promise?: any;
}
declare class AsyncLock {
constructor(options?: AsyncLockOptions);
acquire(key: string | string[], fn: (done: AsyncLockDoneCallback)
=> any, cb: AsyncLockDoneCallback, opts?: AsyncLockOptions): void;
acquire(key: string | string[], fn: (done: AsyncLockDoneCallback)
=> any, opts?: AsyncLockOptions): PromiseLike<any>;
isBusy(): boolean;
}
declare namespace AsyncLock { }
export = AsyncLock;
在我看来,这里似乎正在导出异步锁。我的导入定义哪里出错了?