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
console.log auto imports import console=require('console'); #30471
Comments
Same here (Ubuntu 18.04). It came with the new VSCode update.. Very annoying. |
Seems to be caused by declare module "console" {
export = console;
} in |
Does this reproduce in the latest VS Code insiders build with all extensions disabled? Make sure you are using the latest TypeScript version too Also @Zlass which version of the node typings are you using? I don't see that declaration in the latest |
Ok, I believe I found the cause. Seems like it's a bug related I was able to reproduce it in the insider build by creating a new typescript react app with I don't think this is a VS Code issue and there's already an open issue for it in |
Hmmm, I don't use styled components. Not impossible that it came along with some other library |
@mschipperheyn I'd recommend checking what shows up when you try to auto-complete |
I'm experiencing the same (on version 1.30.2). It's a React Native project, not using Styled Components (but any other lib might). When typing Edit: Seems like on my setup its pointing to the following |
Add a console.d.ts file to your src root and add the following contents:
That will fix your import |
Thanks @BrendonSled for that temp fix... that seems to have resolved it for me - now to add this to all my other projects 🙈 |
This issue has been marked as 'External' and has seen no recent activity. It has been automatically closed for house-keeping purposes. |
@BrendonSled thanks you !! Finally a tmp solution |
Anyone have an update on this beyond temporary solutions? Google only returns this link and the StackOverflow link posted before |
@BrendonSled thx for your solution |
This is driving me crazy... |
Argh, this is so annoying! |
Same problem here. I'm on Linux Mint 19.1. The only way I can get around this Go to OR Go to
|
same problem here visual studio 1.33.1 node 10 |
This is infuriating. Would be great if we could blacklist certain auto imports. |
This is exceedingly annoying. The workaround posted by @BrendonSled is invalid according to strict ts. Any other way to fix this?
|
@AndrewMorsillo give some suggestions on this issue a try. In particular, both this suggestion and this suggestion seem to have improved the situation for me. |
It means the problem has already been fixed and will be fixed in the next version of VS Code. |
this is still not fixed in the latest version of vscode |
Do we have any recent update for this issue? this issue still persist in the latest version of vscode for me as well. |
Sorry, my bad. It will be in next month's release. Insiders and users of https://marketplace.visualstudio.com/items?itemName=ms-vscode.vscode-typescript-next will have the fix available. |
@DanielRosenwasser Are you sure about that? I have |
I'm seeing the issue with both VScode Insider (without the plugin) and VSCode (with the plugin installed). They both seem to use VSCode
VSCode Insider
|
Could this please be reopened? Because it's not fixed yet (not even with the Typescript Nightly plugin) |
Hey all, is someone able to share an actual repo that has this issue? It sounds crazy, but I can’t repro at all. TypeScript has had special handling for excluding auto-imports for declarations that just re-export a global for over a year. The fact that that’s not happening for all of you means something very strange, but apparently quite common, is going on. My best guess is that some combination of dependencies has given you two different versions of Update: figured out a repro. Disregard. |
Looks like this won't make it into the RC, but should make it into the nightly and the proper release of 3.6. |
I run Mac and Ubuntu. Mac is fine, Ubuntu has this issue. For whoever is saying JavaScript and TypeScript Nightly isn't working, make sure to configure it properly:
|
I was happily living without this issue until I installed styled-components and there it is again. |
@tlaak what version of TypeScript are you using? I’m quite sure I fixed this in 3.6. Of course, older versions of TypeScript will continue to exhibit this behavior forever. |
@andrewbranch I think I was using the older 3.5.x version set up by create-react-app. But anyway, I don't have access to the project anymore so can't confirm. |
@andrewbranch I just had the pleasure of running into this very annoying issue with my project, and after upgrading TypeScript from 3.5.x to 3.6 I can confirm that it's fixed!! 🎉 FYI for anyone else with this issue: make sure that the version of Typescript in the bottom right corner of VS Code is also set to 3.6.x |
@Zlass this is a life saver 🙏 For anyone who still have issues: you can follow steps on stackoverflow |
It is back... |
@Arcanorum Please create new issues instead of posting on 4 year old ones |
Steps to Reproduce:
type
console.
. 7 times out of 10, vscode will insertimport console=require('console');
in the imports top of the file leading to a compilation error.Single most annoying issue of vs code by far.
Does this issue occur when all extensions are disabled?: Not sure
The text was updated successfully, but these errors were encountered: