/** * Python's threading.Lock, for asynchronous code: run(fn) calls fn once the previous calls are done. */ export class Lock { _tail: Promise; /** * Runs a function holding the lock, like `with lock:` in Python. * @template T * @param {function(): (T|Promise)} fn * @returns {Promise} */ run(fn: () => (T | Promise)): Promise; }