-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Local variable called 'name' conflicts with lib.d.ts 'name' #31783
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
Comments
If you are not targeting the web, you can disable dom typings by setting
|
Just for background, this is where it comes from: https://developer.mozilla.org/en-US/docs/Web/API/Window/name — meaning it's unavoidable and not a TS issue, since it is a global variable. EDIT: Okay, this should still be recognized as being overridden by a local variable in your code example. When I try that I have no issues though, "Jump to definition" takes me to the |
@mjbvz That wasn't a |
@lll000111 This is my code and that what I have. I don't understand how it worked for you. Tell me what's your steps. |
I use WebStorm — but the TS language service. If that makes any difference it's not a TS issue anyway. I added a |
@lll000111 Have you hovered over the name variable in the |
@lll000111 Are you here? |
Yes.
I'm not sitting in front of a computer 24x7... |
@lll000111 Can you transfer this issue back to vs code issues? |
@minkir014 Me??? |
If you can't. I'll close this issue and start another one with the same name. |
TypeScript provides all the language services to VSCode, so it being here is appropriate. See #18433 for further information about the issue. |
I don't know why this was closed. @minkir014 We explained why this is happening and are keeping this open to see if the experience can be improved |
but it's strange that it works in webstorm and also the compiler understands that. |
This is the intended behavior - without any other clues to the contrary, we assume you're editing a script file in a browser context. |
My project was targeting web with HTML, CSS and JavaScript and that works perfectly in web storm and also the browser evaluates that right. So, I think it must be a problem with vs code. So, reopen this issue,please. |
I think it's the same problem as #31800 and as what's said there the root problem is what my issue is talking about. So, reopen this issue and thank you. |
This is the intended behavior and we don't intend to change anything here. Issues that don't have concrete next steps are closed, so that's the state this one will remain in unless there is evidence to suggest concrete next steps that should be done from our side. |
I am not who will tell you what will you do.. I am reporting a bug. This is not a PR. |
I have a variable called
name
and it seems to be duplicated with a const inlib.dom.d.ts
and this affects some functions in vs code like hovering and going to definition.See this picture that shows the problem of hovering
and this shows the problem of going to definition when I press
F12
It goes to this fileThe text was updated successfully, but these errors were encountered: