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
const myFunction = <Label extends string>(label: Label) => {
const label2: Label = label;
console.log(label2);
}
ESLint Config
module.exports = {
parser: "@typescript-eslint/parser",
rules: {
"@typescript-eslint/no-unnecessary-type-parameters": "error",
},
};
tsconfig
Expected Result
When a type parameter is used only once in the function signature, but also referenced elsewhere in the function, the error should not be thrown.
Actual Result
tseslint doesn't seem to detect the second reference to the type outside the signature.
Additional Info
const label2: Label = label
is redundant and has no real world use, but it is the minimum code to reproduce it. I've ran into this error a few times when manipulation objects with a value of type Label[]
for example.