Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork2.8k
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 havesearched for related issues and found none that matched my issue.
- I haveread the FAQ and my problem is not listed.
Playground Link
Repro Code
consta:(string|number)[]=[];constb:number[]=[];constc:Array<string|number>=[];constd: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 neithernumber[]
norArray<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