Closed
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
const a: (string | number)[] = [];
const b: number[] = [];
const c: Array<string | number> = [];
const d: Array<number> = [];
ESLint Config
module.exports = {
parser: "@typescript-eslint/parser",
"rules": {
"@typescript-eslint/array-type": ["error", {"default": "simple-array"}]
}
};
tsconfig
No response
Expected Result
The constants a and d should fail the 'array-simple' rule and thus cause the following errors:
a: Array type using 'T[]' is forbidden for non-simple types. Use 'Array<T>'
d: Array type using 'Array<number>' is forbidden for simple types. Use 'number[]' instead.
Actual Result
All four constants fail the rule and cause errors. This means for example that neither number[]
nor Array<number>
is allowed, making it impossible to annotate array types without causing eslint error, if the "array-type" rule is configured with "simple-array".
Additional Info
No response