New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[no-unused-vars] false positive when class property has the same name as import #2994
Comments
I believe that the bug is here:
This is adding a reference to the |
I same this issue: |
This is a pretty complex problem to solve for all cases. On the one hand - one can naively fix this by placing the reference in the parent scope. import { Test } from './Test';
declare function deco(..._param: any): any;
export class Clazz {
@deco
method<Test>(Test: Test) {}
} I've opened an issue with TypeScript to clarify how it's supposed to work. |
@bradzacher link to this issue? |
🙂 thanks |
There was a response to the TypeScript issue logged by @bradzacher two weeks ago, see microsoft/TypeScript#42679 (comment) - the response states that the described behavior is expected. Commenting to point this out as I'm seeing the same linting error as described here, using @typescript-eslint/eslint-plugin@6.7.5 - since this issue is still open, I'm guessing it's not considered resolved in a later version of the plugin either? |
Repro
https://github.com/kmaraz/no-unused-vars-issue
I'll show you the issue in the pictures:
This works as the class property
thisWorks
has different name from theTest
.This does not work, as the class property
Test
has the same name asTest
import.Hope it helps! :)
Additional Info
Versions
@typescript-eslint/eslint-plugin
4.14.2
@typescript-eslint/parser
4.14.2
TypeScript
4.1.3
ESLint
7.18.0
node
14.15.0
The text was updated successfully, but these errors were encountered: