My dilemma lies in the implementation of a straightforward object class designed to restrict potential values to a specific type:
export class Dictionary<T> {
[key: string]: T
}
Unexpectedly, ESLint is flagging this code with the message
1:25 error 'T' is defined but never used @typescript-eslint/no-unused-vars
, despite its usage on the subsequent line. Could this be an issue within the linter itself, or am I committing an oversight?
I am aware that simply adding a comment to exempt that line from linting is an option, but I would rather address it "properly" if feasible.
The rule has been set up as follows:
"rules": {
"@typescript-eslint/no-unused-vars": [
"error",
{
"ignoreRestSiblings": true
}
],
"no-unused-vars": "off"
}
Potentially relevant package versions include:
"@angular-eslint/builder": "17.3.0",
"@angular-eslint/eslint-plugin": "17.3.0",
"@angular-eslint/eslint-plugin-template": "17.3.0",
"@angular-eslint/schematics": "17.3.0",
"@angular-eslint/template-parser": "17.3.0",
"@typescript-eslint/eslint-plugin": "7.2.0",
"@typescript-eslint/eslint-plugin-tslint": "7.0.2",
"@typescript-eslint/parser": "7.2.0",
"eslint": "8.57.0",
"eslint-plugin-import": "2.29.1",
"eslint-plugin-deprecation": "2.0.0",
"typescript": "5.2.2"