Closed
Description
I've got a function that accepts a function, that should return void
. But it can sometimes be async, so it would return Promise<void>
. The rule should accept a union of both.
So that the following is acceptable:
async function foo(bar: () => void | Promise<void>) {
await bar();
}
The other option would be to, of course, only accept Promise<void>
, but then I'd have to put async
on even funcs that don't use await
, and then I'd get lint errors because of that. I think the solution proposed here is easier, and should still be in line with the spirit of the rule.