Types not compatible
hasezoey opened this issue · comments
simple reproduction code:
// NodeJS: 14.15.3
import * as am from "async-mutex"; // async-mutex@0.3.0
const mutex = new am.Mutex();
function test(param1: string) {
return;
}
(async () => {
// Error: Argument of type 'void' is not assignable to parameter of type 'Worker<unknown>'. ts(2345)
await mutex.runExclusive(test("hi"));
})();
or am i supposed to use it in a different way? this is how i thought it works after looking at https://github.com/DirtyHairy/async-mutex#synchronized-code-execution
sorry, it was an weird error that i forgot that it wants an "function" not an "called function"
fixed with runExclusive(test.bind(null, "hi"));