imports to variable with same name in constructor
See original GitHub issueIf you name a variable the same as an import in typescript, like this:
import {Service} from "..."
constructor(private Service: Service) {}
The plugin will report Service as an unused import. If you run --fix the import is removed, which is wrong.
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
How do I use the same variable name of a ... - Stack Overflow
So I was wondering if I could declare an instance field(ex. str1) and a parameter with the same name. Basicly, I ran something...
Read more >Passing Information to a Method or a Constructor
A parameter can have the same name as one of the class's fields. If this is the case, the parameter is said to...
Read more >Export and Import - The Modern JavaScript Tutorial
We can label any declaration as exported by placing export before it, be it a variable, function or a class. For instance, here...
Read more >constructor - JavaScript - MDN Web Docs - Mozilla
The constructor method is a special method of a class for creating and initializing an object instance of that class.
Read more >2.2. Creating and Initializing Objects: Constructors
When this code executes, it creates a new object of the specified class and calls a constructor, which has the same name as...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
For others who have this problem, the upstream meta-issue tracking the changes needed to fix this is https://github.com/typescript-eslint/typescript-eslint/issues/1856.
I took another look and it’s definitely an upstream issue, closing… I will report upstream, but you should not name your variables with PascalCase anyway 😃