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 const foo: <T, U>(value: U) => T
//generics are now inferred as <number, string>(value: string) => number
const bar = foo("") as number //error: no-unnecessary-type-assertion
ESLint Config
module.exports = {
"rules": {
"@typescript-eslint/no-unnecessary-type-assertion": "error"
}
};
tsconfig
Expected Result
no error
Actual Result
error: no-unnecessary-type-assertion
Additional Info
sometimes it's useful to use a cast instead of specifying the generic, in case you only want to have to specify one type while still having the other types inferred.
Versions
package | version |
---|---|
@typescript-eslint/eslint-plugin |
5.30.7 |
@typescript-eslint/parser |
5.30.7 |
TypeScript |
4.7.2 |
ESLint |
8.15.0 |