Closed
Description
This issue affects e.g. express used with new route handlers which are required to be non-async in their TS typings. I think in case of variadic arguments, the plugin verifies just the 1st argument and, if it's okay, doesn't even check the rest of the arguments.
- I have tried restarting my IDE and the issue persists.
- I have updated to the latest version of the packages.
- I have read the FAQ and my problem is not listed.
Repro
{
"rules": {
"@typescript-eslint/no-misused-promises": "error",
}
}
function get2(_h1: () => void, _h2: () => void) {}
function get(..._handlers: Array<() => void>) {}
get2(
() => {},
async () => {} // <-- fails, which is what we want
);
get(
() => {},
async () => {} // <-- this must fail too, but it does not
);
Expected Result
Both get() and get2() calls must raise an eslint error.
Actual Result
Only get2() is treated as incorrect, and get() is fine - although it should fail too:
Additional Info
Versions
package | version |
---|---|
@typescript-eslint/eslint-plugin |
5.0.0 |
@typescript-eslint/parser |
5.0.0 |
TypeScript |
4.4.4 |
ESLint |
8.0.1 |
node |
16.11.1 |