vscode imports import console = require(“console”); automatically












3














import console = require("console");


console. << I type . and above gets imported automatically in VScode. Anybody knows how to disable that?



(I assume it is one of my extensions. Probably Prettier.)



edit:
it only happens in React Typescript environment. not in Typescript without react.










share|improve this question
























  • any luck with this? I am having the same issue
    – user2517182
    Nov 20 '18 at 20:55
















3














import console = require("console");


console. << I type . and above gets imported automatically in VScode. Anybody knows how to disable that?



(I assume it is one of my extensions. Probably Prettier.)



edit:
it only happens in React Typescript environment. not in Typescript without react.










share|improve this question
























  • any luck with this? I am having the same issue
    – user2517182
    Nov 20 '18 at 20:55














3












3








3







import console = require("console");


console. << I type . and above gets imported automatically in VScode. Anybody knows how to disable that?



(I assume it is one of my extensions. Probably Prettier.)



edit:
it only happens in React Typescript environment. not in Typescript without react.










share|improve this question















import console = require("console");


console. << I type . and above gets imported automatically in VScode. Anybody knows how to disable that?



(I assume it is one of my extensions. Probably Prettier.)



edit:
it only happens in React Typescript environment. not in Typescript without react.







typescript visual-studio-code






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 14 '18 at 13:34

























asked Nov 13 '18 at 10:40









dragonsoul

166




166












  • any luck with this? I am having the same issue
    – user2517182
    Nov 20 '18 at 20:55


















  • any luck with this? I am having the same issue
    – user2517182
    Nov 20 '18 at 20:55
















any luck with this? I am having the same issue
– user2517182
Nov 20 '18 at 20:55




any luck with this? I am having the same issue
– user2517182
Nov 20 '18 at 20:55












1 Answer
1






active

oldest

votes


















2














I experienced this as well an it seems to be a problem with the Auto Import feature in VSCode. Disabling all extensions doesn´t seem to make it go away either.



As a workaround you can disable autoimports in settings.



If you use Javascript



"javascript.suggest.autoImports": false



If you use Typescript



"typescript.suggest.autoImports": false



enter image description here



EDIT: The faulty autoimport occurs because of this code in a package down the dependency tree



declare module "console" {
export = console;
}


The package can be located in either your local node_modules directory or in a referenced package installed globally.




  1. Search your local node_modules for declare module "console"

  2. If you find it in a local package, run npm list [packageName] to determine which package in package.json is dependent on the package with the console code in it.


If you don´t find code in your local node_modules you could either




  1. Eliminate packages one by one in package.json


  2. Search for the console code in globally installed modules which may be referenced by packages in your project



%USERPROFILE%AppDataRoamingnpmnode_modules
%USERPROFILE%AppDataLocalMicrosoftTypeScript



I know it´s not a straight forward solution but I hope it helps, in my case I had a reference from react-native-copilot -> rimraf -> node which had the console code in it. Removing react-native-copilot solved the problem.






share|improve this answer























  • I think that worked. Thanks!
    – user2517182
    Nov 21 '18 at 16:39












  • yeah that also causes no other auto import work anymore. I like this feature and do not accept this as an answer...:-D (thanks though!) There must be another solution. I am still looking as well.
    – dragonsoul
    Nov 22 '18 at 8:49












  • I found out that it does not happen when you create a new project with create-react-app my-app --scripts-version=react-scripts-ts so it must be connected to the workspace settings somehow.
    – dragonsoul
    Nov 22 '18 at 9:29












  • I did some more research, see the edited answer, hope you find it in your project!
    – KvD
    Nov 23 '18 at 15:29










  • Yes That worked indeed. I am thinking, is this a VSCode bug or from the creators of these packages? For me it was in @types/node and @types/react-dom. Thank you :-)
    – dragonsoul
    Nov 26 '18 at 21:12













Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53279182%2fvscode-imports-import-console-requireconsole-automatically%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









2














I experienced this as well an it seems to be a problem with the Auto Import feature in VSCode. Disabling all extensions doesn´t seem to make it go away either.



As a workaround you can disable autoimports in settings.



If you use Javascript



"javascript.suggest.autoImports": false



If you use Typescript



"typescript.suggest.autoImports": false



enter image description here



EDIT: The faulty autoimport occurs because of this code in a package down the dependency tree



declare module "console" {
export = console;
}


The package can be located in either your local node_modules directory or in a referenced package installed globally.




  1. Search your local node_modules for declare module "console"

  2. If you find it in a local package, run npm list [packageName] to determine which package in package.json is dependent on the package with the console code in it.


If you don´t find code in your local node_modules you could either




  1. Eliminate packages one by one in package.json


  2. Search for the console code in globally installed modules which may be referenced by packages in your project



%USERPROFILE%AppDataRoamingnpmnode_modules
%USERPROFILE%AppDataLocalMicrosoftTypeScript



I know it´s not a straight forward solution but I hope it helps, in my case I had a reference from react-native-copilot -> rimraf -> node which had the console code in it. Removing react-native-copilot solved the problem.






share|improve this answer























  • I think that worked. Thanks!
    – user2517182
    Nov 21 '18 at 16:39












  • yeah that also causes no other auto import work anymore. I like this feature and do not accept this as an answer...:-D (thanks though!) There must be another solution. I am still looking as well.
    – dragonsoul
    Nov 22 '18 at 8:49












  • I found out that it does not happen when you create a new project with create-react-app my-app --scripts-version=react-scripts-ts so it must be connected to the workspace settings somehow.
    – dragonsoul
    Nov 22 '18 at 9:29












  • I did some more research, see the edited answer, hope you find it in your project!
    – KvD
    Nov 23 '18 at 15:29










  • Yes That worked indeed. I am thinking, is this a VSCode bug or from the creators of these packages? For me it was in @types/node and @types/react-dom. Thank you :-)
    – dragonsoul
    Nov 26 '18 at 21:12


















2














I experienced this as well an it seems to be a problem with the Auto Import feature in VSCode. Disabling all extensions doesn´t seem to make it go away either.



As a workaround you can disable autoimports in settings.



If you use Javascript



"javascript.suggest.autoImports": false



If you use Typescript



"typescript.suggest.autoImports": false



enter image description here



EDIT: The faulty autoimport occurs because of this code in a package down the dependency tree



declare module "console" {
export = console;
}


The package can be located in either your local node_modules directory or in a referenced package installed globally.




  1. Search your local node_modules for declare module "console"

  2. If you find it in a local package, run npm list [packageName] to determine which package in package.json is dependent on the package with the console code in it.


If you don´t find code in your local node_modules you could either




  1. Eliminate packages one by one in package.json


  2. Search for the console code in globally installed modules which may be referenced by packages in your project



%USERPROFILE%AppDataRoamingnpmnode_modules
%USERPROFILE%AppDataLocalMicrosoftTypeScript



I know it´s not a straight forward solution but I hope it helps, in my case I had a reference from react-native-copilot -> rimraf -> node which had the console code in it. Removing react-native-copilot solved the problem.






share|improve this answer























  • I think that worked. Thanks!
    – user2517182
    Nov 21 '18 at 16:39












  • yeah that also causes no other auto import work anymore. I like this feature and do not accept this as an answer...:-D (thanks though!) There must be another solution. I am still looking as well.
    – dragonsoul
    Nov 22 '18 at 8:49












  • I found out that it does not happen when you create a new project with create-react-app my-app --scripts-version=react-scripts-ts so it must be connected to the workspace settings somehow.
    – dragonsoul
    Nov 22 '18 at 9:29












  • I did some more research, see the edited answer, hope you find it in your project!
    – KvD
    Nov 23 '18 at 15:29










  • Yes That worked indeed. I am thinking, is this a VSCode bug or from the creators of these packages? For me it was in @types/node and @types/react-dom. Thank you :-)
    – dragonsoul
    Nov 26 '18 at 21:12
















2












2








2






I experienced this as well an it seems to be a problem with the Auto Import feature in VSCode. Disabling all extensions doesn´t seem to make it go away either.



As a workaround you can disable autoimports in settings.



If you use Javascript



"javascript.suggest.autoImports": false



If you use Typescript



"typescript.suggest.autoImports": false



enter image description here



EDIT: The faulty autoimport occurs because of this code in a package down the dependency tree



declare module "console" {
export = console;
}


The package can be located in either your local node_modules directory or in a referenced package installed globally.




  1. Search your local node_modules for declare module "console"

  2. If you find it in a local package, run npm list [packageName] to determine which package in package.json is dependent on the package with the console code in it.


If you don´t find code in your local node_modules you could either




  1. Eliminate packages one by one in package.json


  2. Search for the console code in globally installed modules which may be referenced by packages in your project



%USERPROFILE%AppDataRoamingnpmnode_modules
%USERPROFILE%AppDataLocalMicrosoftTypeScript



I know it´s not a straight forward solution but I hope it helps, in my case I had a reference from react-native-copilot -> rimraf -> node which had the console code in it. Removing react-native-copilot solved the problem.






share|improve this answer














I experienced this as well an it seems to be a problem with the Auto Import feature in VSCode. Disabling all extensions doesn´t seem to make it go away either.



As a workaround you can disable autoimports in settings.



If you use Javascript



"javascript.suggest.autoImports": false



If you use Typescript



"typescript.suggest.autoImports": false



enter image description here



EDIT: The faulty autoimport occurs because of this code in a package down the dependency tree



declare module "console" {
export = console;
}


The package can be located in either your local node_modules directory or in a referenced package installed globally.




  1. Search your local node_modules for declare module "console"

  2. If you find it in a local package, run npm list [packageName] to determine which package in package.json is dependent on the package with the console code in it.


If you don´t find code in your local node_modules you could either




  1. Eliminate packages one by one in package.json


  2. Search for the console code in globally installed modules which may be referenced by packages in your project



%USERPROFILE%AppDataRoamingnpmnode_modules
%USERPROFILE%AppDataLocalMicrosoftTypeScript



I know it´s not a straight forward solution but I hope it helps, in my case I had a reference from react-native-copilot -> rimraf -> node which had the console code in it. Removing react-native-copilot solved the problem.







share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 23 '18 at 15:27

























answered Nov 21 '18 at 6:12









KvD

312




312












  • I think that worked. Thanks!
    – user2517182
    Nov 21 '18 at 16:39












  • yeah that also causes no other auto import work anymore. I like this feature and do not accept this as an answer...:-D (thanks though!) There must be another solution. I am still looking as well.
    – dragonsoul
    Nov 22 '18 at 8:49












  • I found out that it does not happen when you create a new project with create-react-app my-app --scripts-version=react-scripts-ts so it must be connected to the workspace settings somehow.
    – dragonsoul
    Nov 22 '18 at 9:29












  • I did some more research, see the edited answer, hope you find it in your project!
    – KvD
    Nov 23 '18 at 15:29










  • Yes That worked indeed. I am thinking, is this a VSCode bug or from the creators of these packages? For me it was in @types/node and @types/react-dom. Thank you :-)
    – dragonsoul
    Nov 26 '18 at 21:12




















  • I think that worked. Thanks!
    – user2517182
    Nov 21 '18 at 16:39












  • yeah that also causes no other auto import work anymore. I like this feature and do not accept this as an answer...:-D (thanks though!) There must be another solution. I am still looking as well.
    – dragonsoul
    Nov 22 '18 at 8:49












  • I found out that it does not happen when you create a new project with create-react-app my-app --scripts-version=react-scripts-ts so it must be connected to the workspace settings somehow.
    – dragonsoul
    Nov 22 '18 at 9:29












  • I did some more research, see the edited answer, hope you find it in your project!
    – KvD
    Nov 23 '18 at 15:29










  • Yes That worked indeed. I am thinking, is this a VSCode bug or from the creators of these packages? For me it was in @types/node and @types/react-dom. Thank you :-)
    – dragonsoul
    Nov 26 '18 at 21:12


















I think that worked. Thanks!
– user2517182
Nov 21 '18 at 16:39






I think that worked. Thanks!
– user2517182
Nov 21 '18 at 16:39














yeah that also causes no other auto import work anymore. I like this feature and do not accept this as an answer...:-D (thanks though!) There must be another solution. I am still looking as well.
– dragonsoul
Nov 22 '18 at 8:49






yeah that also causes no other auto import work anymore. I like this feature and do not accept this as an answer...:-D (thanks though!) There must be another solution. I am still looking as well.
– dragonsoul
Nov 22 '18 at 8:49














I found out that it does not happen when you create a new project with create-react-app my-app --scripts-version=react-scripts-ts so it must be connected to the workspace settings somehow.
– dragonsoul
Nov 22 '18 at 9:29






I found out that it does not happen when you create a new project with create-react-app my-app --scripts-version=react-scripts-ts so it must be connected to the workspace settings somehow.
– dragonsoul
Nov 22 '18 at 9:29














I did some more research, see the edited answer, hope you find it in your project!
– KvD
Nov 23 '18 at 15:29




I did some more research, see the edited answer, hope you find it in your project!
– KvD
Nov 23 '18 at 15:29












Yes That worked indeed. I am thinking, is this a VSCode bug or from the creators of these packages? For me it was in @types/node and @types/react-dom. Thank you :-)
– dragonsoul
Nov 26 '18 at 21:12






Yes That worked indeed. I am thinking, is this a VSCode bug or from the creators of these packages? For me it was in @types/node and @types/react-dom. Thank you :-)
– dragonsoul
Nov 26 '18 at 21:12




















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53279182%2fvscode-imports-import-console-requireconsole-automatically%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks

Calculate evaluation metrics using cross_val_predict sklearn

Insert data from modal to MySQL (multiple modal on website)