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 as not planned
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 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
typeAction<T>={category:T}functionmyFunc<T=number>(actions:Action<T>[]){constarrayArray=[actions]arrayArray.sort((a,b)=>{constaItem=a[0]constbItem=b[0]// This line produces://// 2362: The left-hand side of an arithmetic operation must be of type 'any',// 'number', 'bigint' or an enum type.//// return aItem.category - bItem.categoryreturn(aItem.categoryasany)-(bItem.categoryasany)})}
ESLint Config
module.exports={"rules":{"@typescript-eslint/no-unnecessary-type-assertion":"error"}}
tsconfig
{"compilerOptions": {"strictNullChecks":true }}
Expected Result
There should be no linting errors, since theas any
type assertions are necessary.
Actual Result
Theas any
type assertions are reported as unnecessary.
Additional Info
No response
Versions
package | version |
---|---|
@typescript-eslint/eslint-plugin | 5.33.1 |
@typescript-eslint/parser | 5.33.1 |
TypeScript | 4.7.4 |
ESLint | 8.15.0 |
node | web |