Closed as not planned
Description
Before You File a Bug Report Please Confirm You Have Done The Following...
- I have tried restarting my IDE and the issue persists.
- I have updated to the latest version of the packages.
- I have searched for related issues and found none that matched my issue.
- I have read the FAQ and my problem is not listed.
Playground Link
Repro Code
declare function mx<T>(): T;
mx<void>();
logAndReturn<void>(undefined);
let voidPromise: Promise<void> = new Promise<void>(() => { });
let voidMap: Map<string, void> = new Map<string, void>();
ESLint Config
module.exports = {
parser: "@typescript-eslint/parser",
rules: {
"@typescript-eslint/no-invalid-void-type": "error"
},
};
tsconfig
Expected Result
I expected all of these to be considered valid uses of void
Actual Result
Only the last two uses are considered valid.
Additional Info
Maybe I'm missing something but I've read the docs a couple of times and the issues, and I can't find anything explaining why this general use of void
is being flagged - or inversely, anything confirming that there is more logic than just "is this a generic?".
Importantly the logAndReturn
is taken from the documentation itself for showcasing
The following patterns are considered warnings with { allowInGenericTypeArguments: false }:
Which implies to me those patterns should not be considered warnings if allowInGenericTypeArguments
is true. This seems to be happening from v5 onwards.