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
// T is used twice - maybe it should say "once in the signature"?
function parseJson<T extends string>(input: string): T {
return JSON.parse(input) as T;
}
// T is used zero times
function parseJson<T extends string>(input: string): any {
return JSON.parse(input) as any;
}
ESLint Config
{
"rules": {
"@typescript-eslint/no-unnecessary-type-parameters": "error"
}
}
tsconfig
Expected Result
I expect the error message should reflect correctly the number of times the type parameter is used.
Actual Result
"Type parameter T is used only once." in both cases
Additional Info
Let's also include a doc change to the docs page, if counting parameters is only supposed to be counting the usages in the signature?